}
bsr->VolSessionId = jr.VolSessionId;
bsr->VolSessionTime = jr.VolSessionTime;
+ if (jr.JobFiles == 0) { /* zero files is OK, not an error, but */
+ bsr->VolCount = 0; /* there are no volumes */
+ continue;
+ }
if ((bsr->VolCount=db_get_job_volume_parameters(ua->jcr, ua->db, bsr->JobId,
&(bsr->VolParams))) == 0) {
ua->error_msg(_("Unable to get Job Volume Parameters. ERR=%s\n"), db_strerror(ua->db));
/*
* Given: a JobId in jcr->previous_jr.JobId,
* this subroutine writes a bsr file to restore that job.
+ * Returns: -1 on error
+ * number of files if OK
*/
-bool create_restore_bootstrap_file(JCR *jcr)
+int create_restore_bootstrap_file(JCR *jcr)
{
RESTORE_CTX rx;
UAContext *ua;
+ int files;
+
memset(&rx, 0, sizeof(rx));
rx.bsr = new_bsr();
rx.JobIds = (char *)"";
rx.bsr->JobId = jcr->previous_jr.JobId;
ua = new_ua_context(jcr);
if (!complete_bsr(ua, rx.bsr)) {
+ files = -1;
goto bail_out;
}
rx.bsr->fi = new_findex();
rx.bsr->fi->findex2 = jcr->previous_jr.JobFiles;
jcr->ExpectedFiles = write_bsr_file(ua, rx);
if (jcr->ExpectedFiles == 0) {
+ files = 0;
goto bail_out;
}
free_ua_context(ua);
free_bsr(rx.bsr);
jcr->needs_sd = true;
- return true;
+ return jcr->ExpectedFiles;
bail_out:
free_ua_context(ua);
free_bsr(rx.bsr);
- return false;
+ return files;
}
/* TODO: redirect command ouput to job log */
return true; /* no work */
}
- create_restore_bootstrap_file(jcr);
+ if (create_restore_bootstrap_file(jcr) < 0) {
+ Jmsg(jcr, M_FATAL, 0, _("Create bootstrap file failed.\n"));
+ return false;
+ }
if (jcr->previous_jr.JobId == 0 || jcr->ExpectedFiles == 0) {
set_jcr_job_status(jcr, JS_Terminated);
extern void free_rstorage(JCR *jcr);
extern bool setup_job(JCR *jcr);
extern void create_clones(JCR *jcr);
-extern bool create_restore_bootstrap_file(JCR *jcr);
+extern int create_restore_bootstrap_file(JCR *jcr);
extern void dird_free_jcr(JCR *jcr);
extern void dird_free_jcr_pointers(JCR *jcr);
extern void cancel_storage_daemon_job(JCR *jcr);
* File daemon but not used).
*/
if (jcr->get_JobLevel() == L_VERIFY_VOLUME_TO_CATALOG) {
- if (!create_restore_bootstrap_file(jcr)) {
+ int stat;
+ /*
+ * Note: negative status is an error, zero status, means
+ * no files were backed up, so skip calling SD and
+ * client.
+ */
+ stat = create_restore_bootstrap_file(jcr);
+ if (stat < 0) { /* error */
return false;
+ } else if (stat == 0) { /* No files, nothing to do */
+ verify_cleanup(jcr, JS_Terminated); /* clean up */
+ return true; /* get out */
}
} else {
jcr->sd_auth_key = bstrdup("dummy"); /* dummy Storage daemon key */
#undef VERSION
#define VERSION "3.0.3"
-#define BDATE "22 August 2009"
-#define LSMDATE "22Aug09"
+#define BDATE "28 August 2009"
+#define LSMDATE "28Aug09"
#define PROG_COPYRIGHT "Copyright (C) %d-2009 Free Software Foundation Europe e.V.\n"
#define BYEAR "2009" /* year for copyright messages in progs */
General:
+28Aug09
+kes Fix bug #1357 Verify jobs fail when job has zero files
26Aug09
kes Fix possible seg fault in db_get_int_handler in accurate code
kes Release orphanned buffers in accurate code.