From: Kern Sibbald Date: Sat, 13 Feb 2010 11:45:13 +0000 (+0100) Subject: Add code to check and prevent setting StorageId to zero X-Git-Tag: Release-5.2.1~1760 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=52cf0d4eb919390dffe96038b1cc6a9fdb7549da;p=bacula%2Fbacula Add code to check and prevent setting StorageId to zero --- 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 */