]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
stored: add some more error handling in run_job()
authorMichal Rakowski <michal.rakowski@baculasystems.com>
Thu, 1 Apr 2021 11:31:13 +0000 (13:31 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:01 +0000 (09:03 +0100)
bacula/src/stored/fd_cmds.c

index 2a5244271849fd03c748ef82d96ba0414f0207f2..c9e3169db208727b00117975e37dd42cad02958d 100644 (file)
@@ -139,8 +139,15 @@ void run_job(JCR *jcr)
          Jmsg0(jcr, M_FATAL, 0, "Append data not accepted\n");
          goto bail_out;
       }
-      append_data_cmd(jcr);
-      append_end_session(jcr);
+
+      if (!append_data_cmd(jcr)) {
+         Jmsg0(jcr, M_FATAL, 0, "Appending data failed\n");
+         goto bail_out;
+      }
+      if (!append_end_session(jcr)) {
+         Dmsg1(050, "append_end_session() failed for JobId: %d\n", jcr->JobId);
+         goto bail_out;
+      }
    } else if (jcr->is_JobType(JT_MIGRATE) || jcr->is_JobType(JT_COPY)) {
       jcr->session_opened = true;
       /* send "3000 OK data" now to avoid a dead lock, the other side is also
@@ -160,7 +167,10 @@ void run_job(JCR *jcr)
          jcr->file_bsock->signal(BNET_EOD);
          goto bail_out;
       }
-      read_data_cmd(jcr);
+      if (!read_data_cmd(jcr)) {
+         Jmsg0(jcr, M_FATAL, 0, "Reading data failed\n");
+         goto bail_out;
+      }
       jcr->file_bsock->signal(BNET_EOD);
    } else {
       /* Either a Backup or Restore job */