From: Michal Rakowski Date: Thu, 1 Apr 2021 11:31:13 +0000 (+0200) Subject: stored: add some more error handling in run_job() X-Git-Tag: Release-11.3.2~578 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f0664f9f91a7efc30b1383c90fc2e9b9966e2e1;p=thirdparty%2Fbacula.git stored: add some more error handling in run_job() --- diff --git a/bacula/src/stored/fd_cmds.c b/bacula/src/stored/fd_cmds.c index 2a5244271..c9e3169db 100644 --- a/bacula/src/stored/fd_cmds.c +++ b/bacula/src/stored/fd_cmds.c @@ -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 */