660233523b8443077366694e359818536b563abe markd Sun Sep 10 23:51:09 2023 -0700 handle use of optional signal defintion diff --git src/hg/hgPhyloPlace/runUsher.c src/hg/hgPhyloPlace/runUsher.c index 8a60a4a..8b98f78 100644 --- src/hg/hgPhyloPlace/runUsher.c +++ src/hg/hgPhyloPlace/runUsher.c @@ -909,30 +909,34 @@ * just a program that needs to remain running in the background after this CGI exits. * This errAborts if setting stdin, stdout or stderr fails, and ignores any other failures. */ { // Set stdin and stdout to /dev/null, stderr to errlogFile, close all other possibly open fds. int newStdin = openRead("/dev/null"); if (dup2(newStdin, STDIN_FILENO) < 0) errnoAbort("daemonishInit: can't dup2 to stdin"); int newStdout = openWrite("/dev/null", TRUE); if (dup2(newStdout, STDOUT_FILENO) < 0) errnoAbort("daemonishInit: can't dup2 to stdout"); if (dup2(newStderr, STDERR_FILENO) < 0) errnoAbort("daemonishInit: can't dup2 to stderr"); closeNonStdDescriptors(); // Reset all signal handlers to their default. +#ifndef SIGRTMAX // may not have real-time extensions +#define SIGRTMAX SIGUSR2 +#endif + int ix; for (ix = 0; ix <= SIGRTMAX; ix++) signal(ix, SIG_DFL); // Reset the signal mask sigset_t sigset; sigemptyset(&sigset); sigprocmask(SIG_SETMASK, &sigset, NULL); // Reset the umask umask(0); } int daemonishSpawn(char *cmd[], char *errlogFile) /* Use a double fork & setgid to create a process with parent process group = initd so it has