b78c73f7d480c51630bb08e5a86f91688045f4cb galt Wed Sep 4 11:23:40 2013 -0700 cleaning up unneeded switch diff --git src/hg/lib/sqlProg.c src/hg/lib/sqlProg.c index 8aa9ff4..0e4bbbb 100644 --- src/hg/lib/sqlProg.c +++ src/hg/lib/sqlProg.c @@ -4,49 +4,39 @@ #include "sqlProg.h" #include "hgConfig.h" #include "obscure.h" #include <sys/types.h> #include <sys/wait.h> #include <signal.h> char *tempFileNameToRemove = NULL; int killChildPid = 0; /* trap signals to remove the temporary file and terminate the child process */ static void sqlProgCatchSignal(int sigNum) /* handler for various terminal signals for removing the temp file */ { -switch (sigNum) - { - case SIGTERM: - case SIGHUP: - case SIGINT: // ctrl-c - case SIGABRT: - case SIGSEGV: - case SIGFPE: - case SIGBUS: + if (tempFileNameToRemove) unlink(tempFileNameToRemove); - break; - } if (killChildPid != 0) // the child should be runing { - if (sigNum == SIGINT) + if (sigNum == SIGINT) // control-C usually { - kill(killChildPid, SIGINT); // sometimes redundant, but not always + kill(killChildPid, SIGINT); // sometimes redundant, but not if someone sends SIGINT directly to the parent. sleep(5); } kill(killChildPid, SIGTERM); } if (sigNum == SIGTERM || sigNum == SIGHUP) exit(1); // so that atexit cleanup get called raise(SIGKILL); } void sqlProgInitSigHandlers() /* set handler for various terminal signals for logging purposes. * if dumpStack is TRUE, attempt to dump the stack. */ {