sockfilt will quit when orphaned
authorYang Tse <yangsita@gmail.com>
Sun, 17 Feb 2008 04:36:08 +0000 (04:36 +0000)
committerYang Tse <yangsita@gmail.com>
Sun, 17 Feb 2008 04:36:08 +0000 (04:36 +0000)
configure.ac
tests/server/sockfilt.c

index b34ef78..0f41900 100644 (file)
@@ -2002,6 +2002,7 @@ AC_CHECK_FUNCS( strtoll \
                 strlcat \
                 getpwuid \
                 geteuid \
+                getppid \
                 utime \
                 sigsetjmp \
                 basename \
index 9962a4c..7c3404c 100644 (file)
@@ -181,6 +181,13 @@ static int juggle(curl_socket_t *sockfdp,
   unsigned char buffer[17010];
   char data[16];
 
+#ifdef HAVE_GETPPID
+  /* As a last resort, quit if sockfilt process becomes orphan. Just in case
+     parent ftpserver process has died without killing its sockfilt children */
+  if(getppid() <= 1)
+    return FALSE;
+#endif
+
   timeout.tv_sec = 120;
   timeout.tv_usec = 0;