28 lines
1018 B
Diff
28 lines
1018 B
Diff
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 */
|