--- src/stunnel.c.orig Sat Jun 21 23:32:45 2008 +++ src/stunnel.c Mon Sep 22 21:15:10 2008 @@ -175,11 +175,11 @@ static void daemon_loop(void) { #if !defined (USE_WIN32) && !defined (__vms) && !defined(USE_OS2) if(!(options.option.foreground)) daemonize(); + create_pid(); #ifdef HAVE_CHROOT change_root(); #endif /* HAVE_CHROOT */ drop_privileges(); - create_pid(); #endif /* standard Unix */ /* create exec+connect services */ for(opt=local_options.next; opt; opt=opt->next) {