summaryrefslogtreecommitdiff
blob: 43c25ac6445c436d492d2812811e2a9152a0d30d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
diff -ur -x '*~' libcdio-0.75/lib/driver/FreeBSD/freebsd_ioctl.c libcdio-0.75-fbsd/lib/driver/FreeBSD/freebsd_ioctl.c
--- libcdio-0.75/lib/driver/FreeBSD/freebsd_ioctl.c	2005-01-27 05:00:48.000000000 +0100
+++ libcdio-0.75-fbsd/lib/driver/FreeBSD/freebsd_ioctl.c	2005-07-23 18:55:58.379631392 +0200
@@ -140,25 +140,20 @@
 }
 
 /*!
-  Eject media. Return 1 if successful, 0 otherwise.
+  Eject media. Return 0 if successful, 1 otherwise.
  */
 int 
 eject_media_freebsd_ioctl (_img_private_t *env) 
 {
   _img_private_t *_obj = env;
-  int ret=2;
-  int fd;
+  int ret=1;
 
-  if ((fd = open(_obj->gen.source_name, O_RDONLY|O_NONBLOCK)) > -1) {
-    ret = 1;
-    if (ioctl(fd, CDIOCALLOW) == -1) {
-      cdio_warn("ioctl(fd, CDIOCALLOW) failed: %s\n", strerror(errno));
-    } else if (ioctl(fd, CDIOCEJECT) == -1) {
-      cdio_warn("ioctl(CDIOCEJECT) failed: %s\n", strerror(errno));
-    } else {
-      ret = 0;
-    }
-    close(fd);
+  if (ioctl(_obj->gen.fd, CDIOCALLOW) == -1) {
+    cdio_warn("ioctl(fd, CDIOCALLOW) failed: %s\n", strerror(errno));
+  } else if (ioctl(_obj->gen.fd, CDIOCEJECT) == -1) {
+    cdio_warn("ioctl(CDIOCEJECT) failed: %s\n", strerror(errno));
+  } else {
+    ret=0;
   }
 
   return ret;