http://bugs.gentoo.org/116731 --- eject-2.0.13/eject.c +++ eject-2.0.13/eject.c @@ -657,7 +657,15 @@ /* Open a device file. */ static int OpenDevice(const char *fullName) { - int fd = open(fullName, O_RDONLY|O_NONBLOCK); + int flags = O_NONBLOCK; + int fd; + + if (s_option) + flags |= O_RDWR; + else + flags |= O_RDONLY; + + fd = open(fullName, flags); if (fd == -1) { fprintf(stderr, _("%s: unable to open `%s'\n"), programName, fullName); exit(1);