Forgot close of file descriptor.

This commit is contained in:
rocky
2005-03-11 02:10:11 +00:00
parent 6cc745b6e0
commit aa74e98227

View File

@@ -1,5 +1,5 @@
/* /*
$Id: freebsd.c,v 1.22 2005/03/11 02:08:05 rocky Exp $ $Id: freebsd.c,v 1.23 2005/03/11 02:10:11 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -27,7 +27,7 @@
# include "config.h" # include "config.h"
#endif #endif
static const char _rcsid[] = "$Id: freebsd.c,v 1.22 2005/03/11 02:08:05 rocky Exp $"; static const char _rcsid[] = "$Id: freebsd.c,v 1.23 2005/03/11 02:10:11 rocky Exp $";
#include "freebsd.h" #include "freebsd.h"
@@ -718,15 +718,14 @@ driver_return_code_t
close_tray_freebsd (const char *psz_device) close_tray_freebsd (const char *psz_device)
{ {
#ifdef HAVE_FREEBSD_CDROM #ifdef HAVE_FREEBSD_CDROM
int i_rc;
int fd = open (psz_device, O_RDONLY|O_NONBLOCK, 0); int fd = open (psz_device, O_RDONLY|O_NONBLOCK, 0);
i_rc = DRIVER_OP_SUCCESS;
if((i_rc = ioctl(fd, CDIOCSTART)) != 0) { if((i_rc = ioctl(fd, CDIOCSTART)) != 0) {
cdio_warn ("ioctl CDROMCLOSETRAY failed: %s\n", strerror(errno)); cdio_warn ("ioctl CDROMCLOSETRAY failed: %s\n", strerror(errno));
i_rc = DRIVER_OP_ERROR; return DRIVER_OP_ERROR;
} }
return i_rc; close(fd);
return DRIVER_OP_SUCCESS;
#else #else
return DRIVER_OP_NO_DRIVER; return DRIVER_OP_NO_DRIVER;
#endif /*HAVE_FREEBSD_CDROM*/ #endif /*HAVE_FREEBSD_CDROM*/