[Pkg-privacy-commits] [onioncat] 160/340: - stdio is closed if process is backgrounded - If signalled twice (TERM, INT) it immediately exits
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 13:04:35 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch debian
in repository onioncat.
commit e1685a63a16cae88db647fc3c6699409c7cf65b5
Author: eagle <eagle at 58e1ccc2-750e-0410-8d0d-f93ca75ab447>
Date: Sat Feb 21 11:33:15 2009 +0000
- stdio is closed if process is backgrounded
- If signalled twice (TERM, INT) it immediately exits
git-svn-id: http://www.cypherpunk.at/svn/onioncat/trunk@472 58e1ccc2-750e-0410-8d0d-f93ca75ab447
---
AUTHORS | 4 ++++
ChangeLog | 2 ++
Makefile.in | 3 ++-
configure | 22 +++++++++++-----------
src/ocat.c | 22 ++++++++++++++++++++++
src/ocatroute.c | 2 +-
6 files changed, 42 insertions(+), 13 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index 51edff5..7594bf1 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,2 +1,6 @@
* Bernhard Fischer <rahra _at_ cypherpunk at>
+ - code
+* Debian and Ubuntu packages: Ferdinand Haselbacher <fhasex20 _at_ cypherpunk at>
+ - Debian package
+ - Ubuntu package
diff --git a/ChangeLog b/ChangeLog
index 103ddcf..b58a94a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,6 @@
* version 0.1.10
+ - stdio is closed if process is backgrounded
+ - If signalled twice (TERM, INT) it immediately exits
- OnionCat daemonizes by default now
- fragment buffer resynchronization enhanced
- disabled connect log if unprivileged user -2 is used
diff --git a/Makefile.in b/Makefile.in
index 5eac59b..ce1f2ab 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -34,7 +34,8 @@ subdir = .
DIST_COMMON = README $(am__configure_deps) $(dist_doc_DATA) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/config.h.in $(top_srcdir)/configure AUTHORS COPYING \
- ChangeLog INSTALL NEWS TODO depcomp install-sh missing
+ ChangeLog INSTALL NEWS TODO config.guess config.sub depcomp \
+ install-sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
diff --git a/configure b/configure
index 6eb9da5..99e4cbf 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for onioncat 0.1.10-464M.
+# Generated by GNU Autoconf 2.61 for onioncat 0.1.10-471M.
#
# Report bugs to <rahra at cypherpunk.at>.
#
@@ -574,8 +574,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='onioncat'
PACKAGE_TARNAME='onioncat'
-PACKAGE_VERSION='0.1.10-464M'
-PACKAGE_STRING='onioncat 0.1.10-464M'
+PACKAGE_VERSION='0.1.10-471M'
+PACKAGE_STRING='onioncat 0.1.10-471M'
PACKAGE_BUGREPORT='rahra at cypherpunk.at'
# Factoring default headers for most tests.
@@ -1206,7 +1206,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures onioncat 0.1.10-464M to adapt to many kinds of systems.
+\`configure' configures onioncat 0.1.10-471M to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1272,7 +1272,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of onioncat 0.1.10-464M:";;
+ short | recursive ) echo "Configuration of onioncat 0.1.10-471M:";;
esac
cat <<\_ACEOF
@@ -1362,7 +1362,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-onioncat configure 0.1.10-464M
+onioncat configure 0.1.10-471M
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1376,7 +1376,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by onioncat $as_me 0.1.10-464M, which was
+It was created by onioncat $as_me 0.1.10-471M, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@@ -2066,7 +2066,7 @@ fi
# Define the identity of the package.
PACKAGE='onioncat'
- VERSION='0.1.10-464M'
+ VERSION='0.1.10-471M'
cat >>confdefs.h <<_ACEOF
@@ -2217,7 +2217,7 @@ ac_config_headers="$ac_config_headers config.h"
cat >>confdefs.h <<\_ACEOF
-#define SVN_REVISION "464M"
+#define SVN_REVISION "471M"
_ACEOF
@@ -5300,7 +5300,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by onioncat $as_me 0.1.10-464M, which was
+This file was extended by onioncat $as_me 0.1.10-471M, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -5353,7 +5353,7 @@ Report bugs to <bug-autoconf at gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-onioncat config.status 0.1.10-464M
+onioncat config.status 0.1.10-471M
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/src/ocat.c b/src/ocat.c
index af7fdc8..b436a2a 100644
--- a/src/ocat.c
+++ b/src/ocat.c
@@ -112,6 +112,7 @@ void background(void)
switch(pid)
{
case -1:
+ CNF(daemon) = 0;
log_msg(LOG_ERR, "fork failed: %s. Staying in foreground", strerror(errno));
return;
@@ -135,6 +136,10 @@ void sig_handler(int sig)
{
case SIGTERM:
case SIGINT:
+ // emergency shutdown if signalled twice
+ if (CNF(sig_term))
+ exit(0);
+
CNF(sig_term) = 1;
break;
}
@@ -204,6 +209,7 @@ int main(int argc, char *argv[])
int c, runasroot = 0;
struct passwd *pwd, pwdm;
int urlconv = 0;
+ int nullfd;
snprintf(def, 100, "127.0.0.1:%d", OCAT_LISTEN_PORT);
@@ -437,6 +443,22 @@ int main(int argc, char *argv[])
if (CNF(create_clog))
open_connect_log(pwd->pw_dir);
+ // reconnect stdio if logfile ok and daemonized
+ if (CNF(logf) && CNF(daemon))
+ {
+ if ((nullfd = open("/dev/null", O_RDWR)) != -1)
+ {
+ oe_close(0);
+ dup(nullfd);
+ oe_close(1);
+ dup(nullfd);
+ oe_close(2);
+ dup(nullfd);
+ }
+ else
+ log_msg(LOG_ERR, "could not reconnect stdio to /dev/null: \"%s\"", strerror(errno));
+ }
+
// create socks connector thread
run_ocat_thread("connector", socks_connector, NULL);
#ifdef PACKET_QUEUE
diff --git a/src/ocatroute.c b/src/ocatroute.c
index 5c791fc..6f2ccc7 100644
--- a/src/ocatroute.c
+++ b/src/ocatroute.c
@@ -315,7 +315,7 @@ void *socket_receiver(void *p)
log_debug("selecting (maxfd = %d)", maxfd);
if ((maxfd = select(maxfd + 1, &rset, NULL, NULL, &tv)) == -1)
{
- log_msg(LOG_EMERG, "select encountered error: \"%s\", restarting", strerror(errno));
+ log_msg(LOG_ERR, "select encountered error: \"%s\", restarting", strerror(errno));
continue;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/onioncat.git
More information about the Pkg-privacy-commits
mailing list