- /* First unload any tape */
- loaded = get_autochanger_loaded_slot(jcr);
- if (loaded > 0) {
- bnet_fsend(dir, _("3305 Issuing autochanger \"unload slot %d\" command.\n"), loaded);
- slot = dcr->VolCatInfo.Slot;
- dcr->VolCatInfo.Slot = loaded;
- changer = edit_device_codes(jcr, changer, jcr->device->changer_command, "unload");
- int stat = run_program(changer, timeout, NULL);
- if (stat != 0) {
- berrno be;
- be.set_errno(stat);
- Jmsg(jcr, M_INFO, 0, _("3995 Bad autochanger \"unload slot %d\" command: ERR=%s.\n"),
- loaded, be.strerror());
+ /* First unload any tape */
+ loaded = get_autochanger_loaded_slot(dcr);
+ if (loaded > 0) {
+ bnet_fsend(dir,
+ _("3305 Issuing autochanger \"unload slot %d, drive %d\" command.\n"),
+ loaded, drive);
+ slot = dcr->VolCatInfo.Slot;
+ dcr->VolCatInfo.Slot = loaded;
+ changer = edit_device_codes(dcr, changer, "unload");
+ lock_changer(dcr);
+ int stat = run_program(changer, timeout, NULL);
+ unlock_changer(dcr);
+ if (stat != 0) {
+ berrno be;
+ be.set_errno(stat);
+ Jmsg(jcr, M_INFO, 0, _("3995 Bad autochanger \"unload slot %d, drive %d\": ERR=%s.\n"),
+ slot, drive, be.strerror());
+ }
+ dcr->VolCatInfo.Slot = slot;