From: Alain Spineux Date: Tue, 27 Oct 2015 11:41:40 +0000 (+0100) Subject: Improve Jmsg in response(), display SIGNAL number when appropriate X-Git-Tag: Release-7.4.0~186 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4e71b1499aca6689e7b0949699bbdb5cfdee62a6;p=bacula%2Fbacula Improve Jmsg in response(), display SIGNAL number when appropriate --- diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index 05eb87b994..48ade9f95e 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -2462,10 +2462,12 @@ static void filed_free_jcr(JCR *jcr) */ int response(JCR *jcr, BSOCK *sd, char *resp, const char *cmd) { + int ret; + if (sd->errors) { return 0; } - if (bget_msg(sd) > 0) { + if ((ret = bget_msg(sd)) > 0) { Dmsg0(110, sd->msg); if (strcmp(sd->msg, resp) == 0) { return 1; @@ -2479,8 +2481,13 @@ int response(JCR *jcr, BSOCK *sd, char *resp, const char *cmd) cmd, sd->bstrerror()); } else { char buf[256]; - Jmsg4(jcr, M_FATAL, 0, _("Bad response from SD to %s command. Wanted %s, got len=%ld msg=\"%s\"\n"), - cmd, resp, sd->msglen, smartdump(sd->msg, sd->msglen, buf, sizeof(buf))); + if (ret > 0) { + Jmsg4(jcr, M_FATAL, 0, _("Bad response from SD to %s command. Wanted %s, got len=%ld msg=\"%s\"\n"), + cmd, resp, sd->msglen, smartdump(sd->msg, sd->msglen, buf, sizeof(buf))); + } else { + Jmsg3(jcr, M_FATAL, 0, _("Bad response from SD to %s command. Wanted %s, got SIGNAL %s\n"), + cmd, resp, bnet_sig_to_ascii(ret)); + } } return 0; }