]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Cleanup Jsmg/Dmsg calls
authorEric Bollengier <eric@baculasystems.com>
Thu, 16 Feb 2023 11:12:22 +0000 (12:12 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:57:01 +0000 (13:57 +0200)
bacula/src/console/console.c
bacula/src/lib/ini.c
bacula/src/stored/acquire.c
bacula/src/stored/fd_cmds.c
bacula/src/stored/file_dev.c
bacula/src/stored/parse_bsr.c

index ca70cc32b9b7c4f6ef2958a1c7996fad01f83f55..cb48a184a8f39c60c33bc7f42797589b528df45b 100644 (file)
@@ -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;
          }
       }
index 31901b435ec96de284187d6b6a71464121eb623c..627ee61080dcba557efd5f025f7a9f814a77ebb9 100644 (file)
@@ -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,
index b08492e0b255dae3a44b721081690b8a014550b6..c817b9f83b77c054b03c191dbc3cf204e447a73d 100644 (file)
@@ -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;
    }
 
index 194e3a127ffca56038485d6f25c18b265bfbf4c5..b444cb26159e88ed66a0ffac2ed4a95a0063d46d 100644 (file)
@@ -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, "<filed: Command not found: %s\n", fd->msg);
          }
          fd->fsend(ferrmsg);
index e86e2341abf3a0acb3fa4e6dff3d9ae4c798ff7b..c6845461e4940c32de8e0659fa9c4bc0a96ea49a 100644 (file)
@@ -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;
       }
index cd039a4c590440e385182d0e5e051d3925f93255..ff4141621928d260151c0e3ea4a59ec4d4365bc7 100644 (file)
@@ -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;