stunnel/stunnel-4.21-write_pid_as_root.diff

28 lines
972 B
Diff

Index: stunnel-4.21/src/stunnel.c
===================================================================
--- stunnel-4.21.orig/src/stunnel.c
+++ stunnel-4.21/src/stunnel.c
@@ -174,8 +174,8 @@
#ifdef HAVE_CHROOT
make_chroot();
#endif /* HAVE_CHROOT */
- 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) {
@@ -433,8 +433,10 @@
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 */