X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fstored%2Fautochanger.c;h=765c4ac528005b564774bda060bd98987f5e76da;hb=bbbdbbf8e1346435de97896364cef142f35b3f5c;hp=b6225613356fac309f7002752ebb99e71494c173;hpb=bdcddd32cafd978761406b7ad3ca006597c8f1d7;p=bacula%2Fbacula diff --git a/bacula/src/stored/autochanger.c b/bacula/src/stored/autochanger.c index b622561335..765c4ac528 100644 --- a/bacula/src/stored/autochanger.c +++ b/bacula/src/stored/autochanger.c @@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - Bacula® is a registered trademark of John Walker. + Bacula® is a registered trademark of Kern Sibbald. The licensor of Bacula is the Free Software Foundation Europe (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. @@ -378,7 +378,9 @@ bool unload_autochanger(DCR *dcr, int loaded) free_volume(dev); /* Free any volume associated with this drive */ free_pool_memory(changer); } - dev->clear_unload(); + if (ok) { + dev->clear_unload(); + } return ok; } @@ -453,13 +455,12 @@ bool unload_dev(DCR *dcr, DEVICE *dev) save_dev = dcr->dev; /* save dcr device */ dcr->dev = dev; /* temporarily point dcr at other device */ - save_slot = dcr->VolCatInfo.Slot; if (dev->get_slot() <= 0 && get_autochanger_loaded_slot(dcr) <= 0) { - dcr->VolCatInfo.Slot = save_slot; dcr->dev = save_dev; return false; } + save_slot = dcr->VolCatInfo.Slot; dcr->VolCatInfo.Slot = dev->get_slot(); dev->dlock(); @@ -497,7 +498,9 @@ bool unload_dev(DCR *dcr, DEVICE *dev) Dmsg2(100, "Slot %d unloaded %s\n", dev->get_slot(), dev->print_name()); dev->set_slot(0); /* nothing loaded */ } - dev->clear_unload(); + if (ok) { + dev->clear_unload(); + } unlock_changer(dcr); dev->dunlock();