gnu_linux.c: Fix bug reported by Burkhard in eject_media_linux() where

we were closing an open tray.

NEWS/README: note current changes
This commit is contained in:
rocky
2006-10-21 11:38:16 +00:00
parent 63d8add85e
commit 52ed17c992
3 changed files with 12 additions and 11 deletions

5
NEWS
View File

@@ -1,4 +1,4 @@
$Id: NEWS,v 1.102 2006/07/30 13:19:49 rocky Exp $
$Id: NEWS,v 1.103 2006/10/21 11:38:16 rocky Exp $
version 0.78cvs
=====================================
@@ -9,6 +9,7 @@ version 0.78cvs
- libcdio is starting to get updated for UTF-8 support. Strings,
which are guaranteed to be in UTF-8, are returned as a new type
cdio_utf8_t, which is typedef'd to char.
- fixes to eject. On GNU/Linux we unmount filesystems first.
version 0.77
=====================================
@@ -354,4 +355,4 @@ version 0.1
Routines split off from VCDImager.
$Id: NEWS,v 1.102 2006/07/30 13:19:49 rocky Exp $
$Id: NEWS,v 1.103 2006/10/21 11:38:16 rocky Exp $

View File

@@ -1,4 +1,4 @@
$Id: README,v 1.26 2006/04/15 16:22:49 rocky Exp $
$Id: README,v 1.27 2006/10/21 11:38:16 rocky Exp $
This directory contains some simple examples of the use of the libcdio
library.
@@ -21,6 +21,9 @@ audio.c: Sample program to show audio controls.
cdchange.c: A program to test if a CD has been changed since the last
change test.
cdio-eject.c: a stripped-down "eject" command to open or close a CDROM
tray
cdtext.c: A program to show CD-Text and CD disc mode info.
drives.c: A program to show drivers installed and what the default

View File

@@ -1,5 +1,5 @@
/*
$Id: gnu_linux.c,v 1.25 2006/10/21 10:55:18 gmerlin Exp $
$Id: gnu_linux.c,v 1.26 2006/10/21 11:38:16 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002, 2003, 2004, 2005, 2006 Rocky Bernstein
@@ -28,7 +28,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: gnu_linux.c,v 1.25 2006/10/21 10:55:18 gmerlin Exp $";
static const char _rcsid[] = "$Id: gnu_linux.c,v 1.26 2006/10/21 11:38:16 rocky Exp $";
#include <string.h>
#include <limits.h>
@@ -707,14 +707,14 @@ eject_media_linux (void *p_user_data) {
_img_private_t *p_env = p_user_data;
driver_return_code_t ret=DRIVER_OP_SUCCESS;
int status;
int was_open = 0;
bool was_open = false;
char mount_target[PATH_MAX];
if ( p_env->gen.fd <= -1 ) {
p_env->gen.fd = open (p_env->gen.source_name, O_RDONLY|O_NONBLOCK);
}
else {
was_open = 1;
was_open = true;
}
if ( p_env->gen.fd <= -1 ) return DRIVER_OP_ERROR;
@@ -722,10 +722,7 @@ eject_media_linux (void *p_user_data) {
if ((status = ioctl(p_env->gen.fd, CDROM_DRIVE_STATUS, CDSL_CURRENT)) > 0) {
switch(status) {
case CDS_TRAY_OPEN:
if((ret = ioctl(p_env->gen.fd, CDROMCLOSETRAY)) != 0) {
cdio_warn ("ioctl CDROMCLOSETRAY failed: %s\n", strerror(errno));
ret = DRIVER_OP_ERROR;
}
cdio_info ("Drive status reports that tray is open\n");
break;
default:
cdio_info ("Unknown state of CD-ROM (%d)\n", status);