File eject-2.1.0-status.diff of Package eject
--- eject.c
+++ eject.c
@@ -68,6 +68,7 @@
#include <scsi/scsi.h>
#include <scsi/sg.h>
#include <scsi/scsi_ioctl.h>
+#include <scsi/sg_io_linux.h>
#include <sys/time.h>
/* Used by the ToggleTray() function. If ejecting the tray takes this
@@ -582,17 +583,17 @@
io_hdr.cmdp = allowRmBlk;
status = ioctl(fd, SG_IO, (void *)&io_hdr);
- if (status < 0)
+ if (status < 0 || io_hdr.host_status != DID_OK || io_hdr.driver_status != DRIVER_OK)
return 0;
io_hdr.cmdp = startStop1Blk;
status = ioctl(fd, SG_IO, (void *)&io_hdr);
- if (status < 0)
+ if (status < 0 || io_hdr.host_status != DID_OK || io_hdr.driver_status != DRIVER_OK)
return 0;
io_hdr.cmdp = startStop2Blk;
status = ioctl(fd, SG_IO, (void *)&io_hdr);
- if (status < 0)
+ if (status < 0 || io_hdr.host_status != DID_OK || io_hdr.driver_status != DRIVER_OK)
return 0;
return 1;