@@ -358,7 +358,9 @@ static void remove_pidfile(const char *pidfile)
358358{
359359 if (unlink (pidfile ) != 0 ) {
360360 ERRORF ("Failed to remove pidfile: \"%s\": %s" , pidfile , strerror (errno ));
361+ return ;
361362 }
363+ INFOF ("Removed pidfile \"%s\" for process %d" , pidfile , getpid ());
362364}
363365
364366static int create_pidfile (const char * pidfile )
@@ -385,6 +387,7 @@ static int create_pidfile(const char *pidfile)
385387 return -1 ;
386388 }
387389
390+ INFOF ("Created pidfile \"%s\" for process %d" , pidfile , getpid ());
388391 return fd ;
389392}
390393
@@ -406,16 +409,6 @@ int main(int argc, char *argv[]) {
406409 WARN ("Seems running with SETUID. This is insecure and highly discouraged: See README.md" );
407410 }
408411
409- if (sigsetjmp (jmpbuf , 1 ) != 0 ) {
410- goto done ;
411- }
412- signal (SIGHUP , signalhandler );
413- signal (SIGINT , signalhandler );
414- signal (SIGTERM , signalhandler );
415-
416- // We will receive EPIPE on the socket.
417- signal (SIGPIPE , SIG_IGN );
418-
419412 int pidfile_fd = -1 ;
420413 if (cliopt -> pidfile != NULL ) {
421414 pidfile_fd = create_pidfile (cliopt -> pidfile );
@@ -432,6 +425,16 @@ int main(int argc, char *argv[]) {
432425 goto done ;
433426 }
434427
428+ if (sigsetjmp (jmpbuf , 1 ) != 0 ) {
429+ goto done ;
430+ }
431+ signal (SIGHUP , signalhandler );
432+ signal (SIGINT , signalhandler );
433+ signal (SIGTERM , signalhandler );
434+
435+ // We will receive EPIPE on the socket.
436+ signal (SIGPIPE , SIG_IGN );
437+
435438 state .sem = dispatch_semaphore_create (1 );
436439
437440 // Queue for vm connections, allowing processing vms requests in parallel.
0 commit comments