From f83864a96d39e0464882da9de508e3bf971ad71e Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 13 Feb 2010 12:45:13 +0100 Subject: [PATCH] Add code to check and prevent setting StorageId to zero --- bacula/src/dird/catreq.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bacula/src/dird/catreq.c b/bacula/src/dird/catreq.c index de2971c269..5af634c290 100644 --- a/bacula/src/dird/catreq.c +++ b/bacula/src/dird/catreq.c @@ -282,7 +282,13 @@ void catalog_request(JCR *jcr, BSOCK *bs) * the number of VolWrites has increased. */ if (jcr->wstore && jcr->wstore->StorageId && sdmr.VolWrites > mr.VolWrites) { - mr.StorageId = jcr->wstore->StorageId; + Dmsg2(050, "Update StorageId old=%d new=%d\n", + mr.StorageId, jcr->wstore->StorageId); + if (jcr->wstore->StorageId == 0) { + Jmsg(jcr, M_ERROR, 0, _("Attempt to set StorageId to zero.\n")); + } else { + mr.StorageId = jcr->wstore->StorageId; + } } /* Copy updated values to original media record */ -- 2.39.5