1 diff --git a/eject.c b/eject.c
2 index 79fd01b..d67089c 100644
5 @@ -543,10 +543,11 @@ static void ToggleTray(int fd)
9 - /* Try to open the CDROM tray and measure the time therefor
10 - * needed. In my experience the function needs less than 0.05
11 + /* Try to open the CDROM tray and measure the time needed.
12 + * In my experience the function needs less than 0.05
13 * seconds if the tray was already open, and at least 1.5 seconds
14 - * if it was closed. */
17 gettimeofday(&time_start, NULL);
19 /* Send the CDROMEJECT command to the device. */
20 @@ -815,10 +816,17 @@ static void Unmount(const char *fullName)
24 -/* Open a device file. */
25 +/* Open a device file. Try opening first read/write, and if that fails then read only. */
26 static int OpenDevice(const char *fullName)
28 - int fd = open(fullName, O_RDONLY|O_NONBLOCK);
31 + fd = open(fullName, O_RDWR|O_NONBLOCK);
36 + fd = open(fullName, O_RDONLY|O_NONBLOCK);
38 fprintf(stderr, _("%s: unable to open `%s'\n"), programName, fullName);