stenc icon indicating copy to clipboard operation
stenc copied to clipboard

stenc should detect an empty LTO drive and return a proper exit code

Open devnullzero opened this issue 8 years ago • 1 comments

When running stenc on a drive with not cartridge, it "waits" doing nothing.

Expected behavior: stenc should detect an empty drive and return a proper exit code.

devnullzero avatar Aug 26 '18 18:08 devnullzero

The SCSIExecute() routine in scsiencrypt.cpp blocks when opening a device that is not ready. When the device is not ready, the Linux kernel keeps polling the drive with SCSI Test Unit Ready commands.

Change the line sg_fd = open(tapedevice, O_RDONLY);

to sg_fd = open(tapedevice, O_RDONLY|O_NDELAY);

scsirob avatar Sep 17 '19 19:09 scsirob