diff --git a/stunnel-4.14-write_pid_as_root.diff b/stunnel-4.14-write_pid_as_root.diff new file mode 100644 index 0000000..57fc805 --- /dev/null +++ b/stunnel-4.14-write_pid_as_root.diff @@ -0,0 +1,27 @@ +Index: stunnel-4.14/src/stunnel.c +=================================================================== +--- stunnel-4.14.orig/src/stunnel.c ++++ stunnel-4.14/src/stunnel.c +@@ -173,8 +173,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 */ +@@ -420,8 +420,10 @@ static void delete_pid(void) { + s_log(LOG_DEBUG, "removing pid file %s", options.pidfile); + if((unsigned long)getpid()!=options.dpid) + return; /* current process is not main daemon process */ +- if(unlink(options.pidfile)<0) +- ioerror(options.pidfile); /* not critical */ ++ if(unlink(options.pidfile)<0) { ++ if(errno!=EACCES && errno!=ENOENT) ++ ioerror(options.pidfile); /* not critical */ ++ } + } + + static void signal_handler(int sig) { /* signal handler */