From 42b4630389962e4865ea1d45a01baa5a9eb86b12 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Wed, 13 Dec 2006 19:14:19 +0000 Subject: Close the device if it was opened but the content isn't that of a VCD. Holding it open prevents eject from working. CVS patchset: 8412 CVS date: 2006/12/13 19:14:19 --- src/input/vcd/vcdio.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/input/vcd/vcdio.c b/src/input/vcd/vcdio.c index 7fee5a0db..31cc0cd49 100644 --- a/src/input/vcd/vcdio.c +++ b/src/input/vcd/vcdio.c @@ -1,5 +1,5 @@ /* - $Id: vcdio.c,v 1.7 2005/06/14 17:27:12 rockyb Exp $ + $Id: vcdio.c,v 1.8 2006/12/13 19:14:19 dsalt Exp $ Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein @@ -103,9 +103,21 @@ vcdio_open(vcdplayer_t *p_vcdplayer, char *intended_vcd_device) } } - if ( vcdinfo_open(&p_vcdplayer->vcd, &intended_vcd_device, DRIVER_UNKNOWN, - NULL) != VCDINFO_OPEN_VCD) { - return false; + switch ( vcdinfo_open(&p_vcdplayer->vcd, &intended_vcd_device, + DRIVER_UNKNOWN, NULL)) + { + case VCDINFO_OPEN_ERROR: + /* Failed to open the device => return failure */ + return false; + + case VCDINFO_OPEN_VCD: + /* Opened the device, and it's a VCD => proceed */ + break; + + default: + /* Opened the device, but it's not a VCD => close it & return failure */ + vcdinfo_close(p_vcdplayer->vcd); + return false; } p_vcdinfo = p_vcdplayer->vcd; -- cgit v1.2.3