--- /dev/null
+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);