stenc
stenc copied to clipboard
stenc should detect an empty LTO drive and return a proper exit code
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.
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);