]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/autochanger.c
ebl Change the new statistic implementation. Remove the UseStatistic
[bacula/bacula] / bacula / src / stored / autochanger.c
index b6225613356fac309f7002752ebb99e71494c173..765c4ac528005b564774bda060bd98987f5e76da 100644 (file)
@@ -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();