1. In the function is_cdrom_linux(...) in the file lib/driver/gnu_linux.c,
the CDROMREADTOCHDR ioctl gets called, which fails when the drive is
empty. The CDROM_GET_CAPABILITY ioctl always succeeds for CDrom drives
and fails for hard disks etc.
2. For some reason, at least my (GNU/Linux 2.6.10) Kernel fails to
open empty drives, when only O_RDONLY is used. Changing the open flag to
O_RDONLY|O_NONBLOCK, the call succeeds also for emtpy drives.
By the way, the cdrom header file in the kernel says explicitely,
that O_RDONLY|O_NONBLOCK should used whenever a cdrom is touched.
rocky: also made a change to eject to continue even if we can't get
the drive status -- which we can't with an empty CD-ROM drive.