]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blobdiff - eject/patches/eject-2.1.5-opendevice.patch
Move all packages to root.
[people/ms/ipfire-3.x.git] / eject / patches / eject-2.1.5-opendevice.patch
diff --git a/eject/patches/eject-2.1.5-opendevice.patch b/eject/patches/eject-2.1.5-opendevice.patch
new file mode 100644 (file)
index 0000000..c85a910
--- /dev/null
@@ -0,0 +1,39 @@
+diff --git a/eject.c b/eject.c
+index 79fd01b..d67089c 100644
+--- a/eject.c
++++ b/eject.c
+@@ -543,10 +543,11 @@ static void ToggleTray(int fd)
+ #ifdef CDROMCLOSETRAY
+-      /* Try to open the CDROM tray and measure the time therefor
+-       * needed.  In my experience the function needs less than 0.05
++      /* Try to open the CDROM tray and measure the time needed.
++       * In my experience the function needs less than 0.05
+        * seconds if the tray was already open, and at least 1.5 seconds
+-       * if it was closed.  */
++       * if it was closed.
++       */
+       gettimeofday(&time_start, NULL);
+       
+       /* Send the CDROMEJECT command to the device. */
+@@ -815,10 +816,17 @@ static void Unmount(const char *fullName)
+ }
+-/* Open a device file. */
++/* Open a device file. Try opening first read/write, and if that fails then read only. */
+ static int OpenDevice(const char *fullName)
+ {
+-      int fd = open(fullName, O_RDONLY|O_NONBLOCK);
++      int fd;
++
++      fd = open(fullName, O_RDWR|O_NONBLOCK);
++      if (fd != -1) {
++              return fd;
++      }
++      
++      fd = open(fullName, O_RDONLY|O_NONBLOCK);
+       if (fd == -1) {
+               fprintf(stderr, _("%s: unable to open `%s'\n"), programName, fullName);
+               exit(1);