summaryrefslogtreecommitdiff
path: root/extra/eject/eject-2.1.5-openrw.patch
blob: 092bfcfdabff44881ad04c4eaee638edfb0da3e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff -pur eject-1/eject.c eject/eject.c
--- eject-1/eject.c	2011-08-19 11:42:22.697388647 +0400
+++ eject/eject.c	2011-08-19 11:57:27.636724026 +0400
@@ -911,7 +911,12 @@ static void Unmount(const char *fullName
 /* Open a device file. */
 static int OpenDevice(const char *fullName)
 {
-	int fd = open(fullName, O_RDONLY|O_NONBLOCK);
+	int fd = open(fullName, O_RDWR|O_NONBLOCK);
+	if (fd == -1 && errno == EACCES) {
+		if (v_option)
+			printf(_("%s: unable to open `%s' for R/W, SCSI commands can be fail. Trying Read-Only\n"), programName, fullName);
+		fd = open(fullName, O_RDONLY|O_NONBLOCK);
+	}
 	if (fd == -1) {
 		fprintf(stderr, _("%s: unable to open `%s'\n"), programName, fullName);
 		exit(1);