From d1a98d84a81e44fee27d874df52d980b329c53af Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Mon, 14 Feb 2011 15:38:19 +0100 Subject: [PATCH] Fix #1695 about bacula-sd crash in detach_dcr_from_dev() --- bacula/src/stored/acquire.c | 3 +++ 1 file changed, 3 insertions(+) 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); } -- 2.39.5