X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=command.c;h=6777ccc971e2590bd2d46879ba428ff1f327f7d8;hp=0a76f68ee03dfeadf2d48e0b5065594caecbfef0;hb=refs%2Fheads%2Fmaint;hpb=d6a87acd98b9e451d488e31b92cdae7673c30ac6 diff --git a/command.c b/command.c index 0a76f68e..427c90fe 100644 --- a/command.c +++ b/command.c @@ -52,12 +52,14 @@ extern struct misc_meta_data *mmd; int send_afs_status(struct command_context *cc, int parser_friendly); static bool subcmd_should_die; +/* + * Don't call PARA_XXX_LOG() here as we might already hold the log mutex. See + * generic_signal_handler() for details. + */ static void command_handler_sighandler(int s) { - if (s != SIGTERM) - return; - PARA_EMERG_LOG("terminating on signal %d\n", SIGTERM); - subcmd_should_die = true; + if (s == SIGTERM) + subcmd_should_die = true; } /* @@ -512,6 +514,7 @@ static int com_stat(struct command_context *cc, struct lls_parse_result *lpr) * while we sleep. */ para_block_signal(SIGTERM); + para_block_signal(SIGUSR1); for (;;) { sigset_t set; /* @@ -543,8 +546,10 @@ static int com_stat(struct command_context *cc, struct lls_parse_result *lpr) * open a race window similar to the one described above. */ pselect(1, NULL, NULL, NULL, &ts, &set); - if (subcmd_should_die) + if (subcmd_should_die) { + PARA_EMERG_LOG("terminating on SIGTERM\n"); goto out; + } ret = -E_SERVER_CRASH; if (getppid() == 1) goto out; @@ -554,7 +559,7 @@ out: } EXPORT_SERVER_CMD_HANDLER(stat); -const char *aux_info_cb(unsigned cmd_num, bool verbose) +static const char *aux_info_cb(unsigned cmd_num, bool verbose) { static char result[80]; unsigned perms = server_command_perms[cmd_num];