From be2c0bb17f666561f6ea7703c4efa85a3ac2a5123ef9748636b44a6f68d6b2f7 Mon Sep 17 00:00:00 2001 From: Daniel Rahn Date: Mon, 23 Jul 2012 09:17:43 +0000 Subject: [PATCH] - Fix background operation to really go into background OBS-URL: https://build.opensuse.org/package/show/security:Stunnel/stunnel?expand=0&rev=59 --- stunnel-daemonize.diff | 31 +++++++++++++++++++++++++++++++ stunnel.changes | 5 +++++ stunnel.spec | 2 ++ 3 files changed, 38 insertions(+) create mode 100644 stunnel-daemonize.diff diff --git a/stunnel-daemonize.diff b/stunnel-daemonize.diff new file mode 100644 index 0000000..4a7db73 --- /dev/null +++ b/stunnel-daemonize.diff @@ -0,0 +1,31 @@ +--- src/stunnel.c ++++ src/stunnel.c +@@ -429,8 +429,8 @@ + } + + static int daemonize(int fd) { /* go to background */ +- if(global_options.option.foreground) +- return 0; ++ if(!(global_options.option.foreground)) ++ { + dup2(fd, 0); + dup2(fd, 1); + dup2(fd, 2); +@@ -441,6 +441,7 @@ + ioerror("daemon"); + return 1; + } ++ + #else + chdir("/"); + switch(fork()) { +@@ -456,7 +457,9 @@ + #ifdef HAVE_SETSID + setsid(); /* ignore the error */ + #endif ++ } + return 0; ++ + } + + static int create_pid(void) { diff --git a/stunnel.changes b/stunnel.changes index 5260d22..3d1c1bf 100644 --- a/stunnel.changes +++ b/stunnel.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jul 23 09:17:13 UTC 2012 - drahn@suse.com + +- Fix background operation to really go into background + ------------------------------------------------------------------- Sat Jul 21 06:19:39 UTC 2012 - drahn@suse.com diff --git a/stunnel.spec b/stunnel.spec index 6fdd74e..1ac9625 100644 --- a/stunnel.spec +++ b/stunnel.spec @@ -34,6 +34,7 @@ Source3: sysconfig.syslog-stunnel Source4: stunnel.rc Patch0: stunnel-listenqueue-option.patch Patch1: stunnel3-binpath.patch +Patch2: stunnel-daemonize.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build %define VENDOR SUSE @@ -61,6 +62,7 @@ stunnel. %setup -q # %patch0 -p0 %patch1 -p0 +%patch2 -p0 %build #autoreconf -fi