[stunnel-users] [PATCH] Fix inetd mode

Miloslav Trmac mitr at redhat.com
Wed Jun 1 13:24:25 CEST 2005


Hello,
the attached patch fixes inetd mode.  signal_pipe[] is not used in
inetd mode, so it was left default-initialized to {0, 0}.  Emptying
"the pipe" would eat all input data.

The second hunk was already posted here by Michal Trojnara.
	Mirek
-------------- next part --------------
--- stunnel-4.10/src/network.c.inetd	2005-06-01 11:39:36.000000000 +0200
+++ stunnel-4.10/src/network.c	2005-06-01 11:43:38.000000000 +0200
@@ -32,7 +32,7 @@
 #include "prototypes.h"
 
 #ifndef USE_WIN32
-static int signal_pipe[2];
+static int signal_pipe[2] = { -1, -1 };
 static char signal_buffer[16];
 static void sigchld_handler(int);
 static void signal_pipe_empty(void);
@@ -136,7 +136,7 @@
     do { /* skip "Interrupted system call" errors */
         retry=0;
         retval=poll(ufds, nfds, min_timeout<0 ? -1 : 1000*min_timeout);
-        if(retval>0 && (*signal_revents & POLLIN)) {
+        if(retval>0 && signal_revents && (*signal_revents & POLLIN)) {
             signal_pipe_empty(); /* no timeout -> main loop */
             retry=1;
         }


More information about the stunnel-users mailing list