From 19e4a36c70f3bebddbdcb5d6942264328eb18cad Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Mon, 1 Feb 2021 12:39:50 +0100 Subject: [PATCH] tape: do not use drive.open() within pmt Do not fail if no media is loaded. Inportant for load command. --- src/bin/pmt.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bin/pmt.rs b/src/bin/pmt.rs index 6fe163b0..985a9b07 100644 --- a/src/bin/pmt.rs +++ b/src/bin/pmt.rs @@ -66,7 +66,7 @@ fn get_tape_handle(param: &Value) -> Result { let (config, _digest) = config::drive::config()?; let drive: LinuxTapeDrive = config.lookup("linux", &name)?; eprintln!("using device {}", drive.path); - return drive.open(); + return Ok(LinuxTapeHandle::new(open_linux_tape_device(&drive.path)?)) } if let Some(device) = param["device"].as_str() { @@ -78,7 +78,7 @@ fn get_tape_handle(param: &Value) -> Result { let (config, _digest) = config::drive::config()?; let drive: LinuxTapeDrive = config.lookup("linux", &name)?; eprintln!("using device {}", drive.path); - return drive.open(); + return Ok(LinuxTapeHandle::new(open_linux_tape_device(&drive.path)?)) } if let Ok(device) = std::env::var("TAPE") { @@ -98,7 +98,7 @@ fn get_tape_handle(param: &Value) -> Result { let name = drive_names[0]; let drive: LinuxTapeDrive = config.lookup("linux", &name)?; eprintln!("using device {}", drive.path); - return drive.open(); + return Ok(LinuxTapeHandle::new(open_linux_tape_device(&drive.path)?)) } bail!("no drive/device specified");