tape: fix write_media_set_label - move to correct position
This commit is contained in:
parent
0ec79339f7
commit
d108b610fd
@ -193,6 +193,17 @@ impl LinuxTapeHandle {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn mtfsf(&mut self, count: i32) -> Result<(), Error> {
|
||||
|
||||
let cmd = mtop { mt_op: MTCmd::MTFSF, mt_count: count, };
|
||||
|
||||
unsafe {
|
||||
mtioctop(self.file.as_raw_fd(), &cmd)
|
||||
}.map_err(|err| format_err!("tape fsf {} failed - {}", count, err))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Set tape compression feature
|
||||
pub fn set_compression(&self, on: bool) -> Result<(), Error> {
|
||||
|
||||
@ -354,6 +365,12 @@ impl TapeDriver for LinuxTapeHandle {
|
||||
|
||||
fn write_media_set_label(&mut self, media_set_label: &MediaSetLabel) -> Result<(), Error> {
|
||||
|
||||
let file_number = self.current_file_number()?;
|
||||
if file_number != 1 {
|
||||
self.rewind()?;
|
||||
self.mtfsf(1)?; // skip label
|
||||
}
|
||||
|
||||
let file_number = self.current_file_number()?;
|
||||
if file_number != 1 {
|
||||
bail!("write_media_set_label failed - got wrong file number ({} != 1)", file_number);
|
||||
|
Loading…
Reference in New Issue
Block a user