From: Eric Bollengier Date: Fri, 12 Aug 2022 08:19:58 +0000 (+0200) Subject: Keep the first FATAL code inside jcr->StatusInfo X-Git-Tag: Beta-15.0.0~464 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7de85e194489b48781a9b8041f5fb9e982809303;p=thirdparty%2Fbacula.git Keep the first FATAL code inside jcr->StatusInfo The Job status code is good, but users have to dig into the log output to determine the reason of the failure. We can keep the first FATAL message code inside jcr->StatusInfo and store it in the catalog to help users. ([DE0001] kind of code) --- diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index e12b08842..83d85d31b 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -357,6 +357,7 @@ public: char *job_user; /* Specific permission for a job */ char *job_group; /* Specific permission for a job */ POOLMEM *StatusErrMsg; /* Error message displayed in the job report */ + char StatusInfo[MAX_NAME_LENGTH]; /* Additionnal information about the error status */ uint32_t getErrors() { return JobErrors + SDErrors; }; /* Get error count */ /* Daemon specific part of JCR */ diff --git a/bacula/src/lib/message.c b/bacula/src/lib/message.c index f00fff45f..7223de132 100644 --- a/bacula/src/lib/message.c +++ b/bacula/src/lib/message.c @@ -1673,6 +1673,14 @@ Jmsg(JCR *jcr, int type, utime_t mtime, const char *fmt,...) dispatch_message(jcr, type, mtime, rbuf); + if (type == M_FATAL && jcr && jcr->StatusInfo[0] == 0) { + char d, t; + int code; + if (scan_string(rbuf+len, "[%c%c%d] ", &d, &t, &code) == 3) { + bsnprintf(jcr->StatusInfo, sizeof(jcr->StatusInfo), "[%c%c%04d]", d, t, code); + } + } + if (type == M_ABORT){ char *p = 0; printf("Bacula forced SEG FAULT to obtain traceback.\n");