Patch from Burkhard Plaum:

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.
This commit is contained in:
rocky
2005-04-23 01:16:19 +00:00
parent 15ddfdbc2c
commit 320c9bd55f
5 changed files with 19 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
/*
$Id: osx.c,v 1.2 2005/03/13 04:42:38 rocky Exp $
$Id: osx.c,v 1.3 2005/04/23 01:16:19 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
from vcdimager code:
@@ -34,7 +34,7 @@
#include "config.h"
#endif
static const char _rcsid[] = "$Id: osx.c,v 1.2 2005/03/13 04:42:38 rocky Exp $";
static const char _rcsid[] = "$Id: osx.c,v 1.3 2005/04/23 01:16:19 rocky Exp $";
#include <cdio/logging.h>
#include <cdio/sector.h>
@@ -1821,7 +1821,7 @@ cdio_open_osx (const char *psz_orig_source)
ret->driver_id = DRIVER_OSX;
if (cdio_generic_init(_data) && init_osx(_data))
if (cdio_generic_init(_data, O_RDONLY) && init_osx(_data))
return ret;
else {
cdio_generic_free (_data);