--- src/stunnel.c.orig	Sun Dec 26 00:05:31 2004
+++ src/stunnel.c	Mon Dec 27 09:09:38 2004
@@ -169,8 +169,8 @@ static void daemon_loop(void) {
 #if !defined (USE_WIN32) && !defined (__vms)
     if(!(options.option.foreground))
         daemonize();
-    drop_privileges();
     create_pid();
+    drop_privileges();
 #endif /* !defined USE_WIN32 && !defined (__vms) */
 
     /* create exec+connect services */
