From: Eric Bollengier Date: Thu, 16 Feb 2023 11:12:22 +0000 (+0100) Subject: Cleanup Jsmg/Dmsg calls X-Git-Tag: Beta-15.0.0~256 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68c3a94e69b552881abe2f8e2118d4ec1869e7b3;p=thirdparty%2Fbacula.git Cleanup Jsmg/Dmsg calls --- diff --git a/bacula/src/console/console.c b/bacula/src/console/console.c index ca70cc32b..cb48a184a 100644 --- a/bacula/src/console/console.c +++ b/bacula/src/console/console.c @@ -1711,7 +1711,7 @@ static int encodecmd(FILE *input, BSOCK *UA_sock) if (strcmp(argk[1], "string") == 0) { str = argv[1]; } else { - senditf("Unable to encode the given string \"%s\". Try to use @encode string=\"yourstring\"\n", argk[1]); + senditf("Unable to encode the given string. Try to use @encode string=\"yourstring\"\n"); return 1; } } diff --git a/bacula/src/lib/ini.c b/bacula/src/lib/ini.c index 31901b435..627ee6108 100644 --- a/bacula/src/lib/ini.c +++ b/bacula/src/lib/ini.c @@ -97,14 +97,14 @@ static void s_err(const char *file, int line, LEX *lc, const char *msg, ...) if (ini->jcr) { /* called from core */ Jmsg(ini->jcr, M_ERROR, 0, _("Config file error: %s\n" - " : Line %d, col %d of file %s\n%s\n"), - buf, lc->line_no, lc->col_no, lc->fname, lc->line); + " : Line %d, col %d of file %s\n"), + buf, lc->line_no, lc->col_no, lc->fname); // } else if (ini->ctx) { /* called from plugin */ // ini->bfuncs->JobMessage(ini->ctx, __FILE__, __LINE__, M_FATAL, 0, // _("Config file error: %s\n" -// " : Line %d, col %d of file %s\n%s\n"), -// buf, lc->line_no, lc->col_no, lc->fname, lc->line); +// " : Line %d, col %d of file %s\n"), +// buf, lc->line_no, lc->col_no, lc->fname); // } else { /* called from ??? */ e_msg(file, line, M_ERROR, 0, diff --git a/bacula/src/stored/acquire.c b/bacula/src/stored/acquire.c index b08492e0b..c817b9f83 100644 --- a/bacula/src/stored/acquire.c +++ b/bacula/src/stored/acquire.c @@ -387,8 +387,8 @@ DCR *acquire_device_for_append(DCR *dcr) if (dev->can_read()) { Mmsg2(jcr->errmsg, "Want to append but %s device %s is busy reading.\n", dev->print_type(), dev->print_name()); - Jmsg(jcr, M_FATAL, 0, jcr->errmsg); - Dmsg0(50, jcr->errmsg); + Jmsg(jcr, M_FATAL, 0, "%s", jcr->errmsg); + Dmsg1(50, "%s", jcr->errmsg); goto get_out; } @@ -422,8 +422,8 @@ DCR *acquire_device_for_append(DCR *dcr) /* Reduce "noise" -- don't print if job canceled */ Mmsg2(jcr->errmsg, _("Could not ready %s device %s for append.\n"), dev->print_type(), dev->print_name()); - Jmsg(jcr, M_FATAL, 0, jcr->errmsg); - Dmsg0(50, jcr->errmsg); + Jmsg(jcr, M_FATAL, 0, "%s", jcr->errmsg); + Dmsg1(50, "%s", jcr->errmsg); } dev->Lock(); unblock_device(dev); @@ -436,8 +436,8 @@ DCR *acquire_device_for_append(DCR *dcr) if (generate_plugin_event(jcr, bsdEventDeviceOpen, dcr) != bRC_OK) { Mmsg0(jcr->errmsg, _("generate_plugin_event(bsdEventDeviceOpen) Failed\n")); - Jmsg(jcr, M_FATAL, 0, jcr->errmsg); - Dmsg0(50, jcr->errmsg); + Jmsg(jcr, M_FATAL, 0, "%s", jcr->errmsg); + Dmsg1(50, "%s", jcr->errmsg); goto get_out; } diff --git a/bacula/src/stored/fd_cmds.c b/bacula/src/stored/fd_cmds.c index 194e3a127..b444cb261 100644 --- a/bacula/src/stored/fd_cmds.c +++ b/bacula/src/stored/fd_cmds.c @@ -238,15 +238,12 @@ void do_client_commands(JCR *jcr) if (!job_canceled(jcr) && !jcr->is_incomplete()) { strip_trailing_junk(fd->msg); char buf[64]; - if (jcr->errmsg[0]) { - strip_trailing_junk(jcr->errmsg); - Jmsg2(jcr, M_FATAL, 0, _("Command error with FD msg=\"%s\", SD hanging up. ERR=%s\n"), - asciidump(fd->msg, fd->msglen, buf, sizeof(buf)), - jcr->errmsg); - } else { - Jmsg1(jcr, M_FATAL, 0, _("Command error with FD msg=\"%s\", SD hanging up.\n"), - asciidump(fd->msg, fd->msglen, buf, sizeof(buf))); - } + strip_trailing_junk(jcr->errmsg); + Dmsg2(50, _("Command error with FD msg=\"%s\", SD hanging up. ERR=%s\n"), + asciidump(fd->msg, fd->msglen, buf, sizeof(buf)), + jcr->errmsg); + Jmsg1(jcr, M_FATAL, 0, _("Command error with FD, SD hanging up. ERR=%s\n"), + jcr->errmsg); jcr->setJobStatus(JS_ErrorTerminated); } quit = true; @@ -256,7 +253,7 @@ void do_client_commands(JCR *jcr) } if (!found) { /* command not found */ if (!job_canceled(jcr)) { - Jmsg1(jcr, M_FATAL, 0, _("FD command not found: %s\n"), fd->msg); + Jmsg0(jcr, M_FATAL, 0, _("FD command not found\n")); Dmsg1(110, "msg); } fd->fsend(ferrmsg); diff --git a/bacula/src/stored/file_dev.c b/bacula/src/stored/file_dev.c index e86e2341a..c6845461e 100644 --- a/bacula/src/stored/file_dev.c +++ b/bacula/src/stored/file_dev.c @@ -582,8 +582,8 @@ bool file_dev::is_eod_valid(DCR *dcr) dcr->VolumeName, edit_uint64_with_commas(size, ed1), edit_uint64_with_commas(VolCatInfo.VolCatBytes, ed2)); - Jmsg(jcr, M_ERROR, 0, jcr->errmsg); - Dmsg0(100, jcr->errmsg); + Jmsg(jcr, M_ERROR, 0, "%s", jcr->errmsg); + Dmsg1(100, "%s", jcr->errmsg); dcr->mark_volume_in_error(); return false; } diff --git a/bacula/src/stored/parse_bsr.c b/bacula/src/stored/parse_bsr.c index cd039a4c5..ff4141621 100644 --- a/bacula/src/stored/parse_bsr.c +++ b/bacula/src/stored/parse_bsr.c @@ -1061,12 +1061,12 @@ static void s_err(const char *file, int line, LEX *lc, const char *msg, ...) if (jcr) { Jmsg(jcr, M_FATAL, 0, _("Bootstrap file error: %s\n" -" : Line %d, col %d of file %s\n%s\n"), - buf, lc->line_no, lc->col_no, lc->fname, lc->line); +" : Line %d, col %d of file %s\n"), + buf, lc->line_no, lc->col_no, lc->fname); } else { e_msg(file, line, M_FATAL, 0, _("Bootstrap file error: %s\n" -" : Line %d, col %d of file %s\n%s\n"), - buf, lc->line_no, lc->col_no, lc->fname, lc->line); +" : Line %d, col %d of file %s\n"), + buf, lc->line_no, lc->col_no, lc->fname); } lc->last_result = -1;