--- src/stunnel.c.orig	Tue Sep 26 10:03:59 2006
+++ src/stunnel.c	Wed Sep 27 16:37:40 2006
@@ -150,8 +150,8 @@ static void daemon_loop(void) {
 #if !defined (USE_WIN32) && !defined (__vms) && !defined(USE_OS2)
     if(!(options.option.foreground))
         daemonize();
-    drop_privileges();
     create_pid();
+    drop_privileges();
 #endif /* !defined USE_WIN32 && !defined (__vms) */
     /* create exec+connect services */
     for(opt=local_options.next; opt; opt=opt->next) {
