From: Eric Bollengier Date: Mon, 14 Feb 2011 14:38:19 +0000 (+0100) Subject: Fix #1695 about bacula-sd crash in detach_dcr_from_dev() X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e0aa4b3ddc4b5dd3942477ee81dd213fba9dbeb9;p=bacula%2Fbacula Fix #1695 about bacula-sd crash in detach_dcr_from_dev() --- diff --git a/bacula/src/stored/acquire.c b/bacula/src/stored/acquire.c index 5cb8949638..146aa4530c 100644 --- a/bacula/src/stored/acquire.c +++ b/bacula/src/stored/acquire.c @@ -682,8 +682,11 @@ static void attach_dcr_to_dev(DCR *dcr) dev = dcr->dev; jcr = dcr->jcr; if (jcr) Dmsg1(500, "JobId=%u enter attach_dcr_to_dev\n", (uint32_t)jcr->JobId); + /* ***FIXME*** return error if dev not initiated */ if (!dcr->attached_to_dev && dev->initiated && jcr && jcr->getJobType() != JT_SYSTEM) { + dev->dlock(); dev->attached_dcrs->append(dcr); /* attach dcr to device */ + dev->dunlock(); dcr->attached_to_dev = true; Dmsg1(500, "JobId=%u attach_dcr_to_dev\n", (uint32_t)jcr->JobId); }