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: solaris.c,v 1.9 2005/03/19 18:50:46 rocky Exp $
$Id: solaris.c,v 1.10 2005/04/23 01:16:19 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -38,7 +38,7 @@
#ifdef HAVE_SOLARIS_CDROM
static const char _rcsid[] = "$Id: solaris.c,v 1.9 2005/03/19 18:50:46 rocky Exp $";
static const char _rcsid[] = "$Id: solaris.c,v 1.10 2005/04/23 01:16:19 rocky Exp $";
#ifdef HAVE_GLOB_H
#include <glob.h>
@@ -258,7 +258,7 @@ static bool
init_solaris (_img_private_t *p_env)
{
if (!cdio_generic_init(p_env)) return false;
if (!cdio_generic_init(p_env, O_RDONLY)) return false;
p_env->access_mode = _AM_SUN_CTRL_SCSI;