From 23547fa2a0687927d684fa8328f2863853c26d06 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Sun, 17 Feb 2008 04:36:08 +0000 Subject: sockfilt will quit when orphaned --- configure.ac | 1 + tests/server/sockfilt.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/configure.ac b/configure.ac index b34ef784c..0f4190005 100644 --- a/configure.ac +++ b/configure.ac @@ -2002,6 +2002,7 @@ AC_CHECK_FUNCS( strtoll \ strlcat \ getpwuid \ geteuid \ + getppid \ utime \ sigsetjmp \ basename \ diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c index 9962a4c40..7c3404c1f 100644 --- a/tests/server/sockfilt.c +++ b/tests/server/sockfilt.c @@ -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; -- cgit v1.2.3