sgutils: allow command which does not transfer any data
This commit is contained in:
parent
f9d71e8b17
commit
7c78d54231
|
@ -216,11 +216,11 @@ impl <'a, F: AsRawFd> SgRaw<'a, F> {
|
||||||
bail!("unknown scsi error - status response {}", status);
|
bail!("unknown scsi error - status response {}", status);
|
||||||
}
|
}
|
||||||
|
|
||||||
let data_len = self.buffer.len() -
|
let resid = unsafe { get_scsi_pt_resid(&*ptvp) } as usize;
|
||||||
(unsafe { get_scsi_pt_resid(&*ptvp) } as usize);
|
if resid > self.buffer.len() {
|
||||||
if data_len == 0 {
|
bail!("do_scsi_pt failed - got strange resid (value too big)");
|
||||||
bail!("do_scsi_pt failed - no data received");
|
|
||||||
}
|
}
|
||||||
|
let data_len = self.buffer.len() - resid;
|
||||||
|
|
||||||
Ok(&self.buffer[..data_len])
|
Ok(&self.buffer[..data_len])
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue