svn commit: trunk/busybox/libbb

landley at busybox.net landley at busybox.net
Tue Oct 11 07:26:25 UTC 2005


Author: landley
Date: 2005-10-11 00:26:15 -0700 (Tue, 11 Oct 2005)
New Revision: 11825

Log:
The check for EROFS was wrong.  For example, if you try to mount a filesystem
appended to an executable that's being run (yes, I'm doing this) you get
EPERM, but mounting readonly fixes it.  Doing the fallback all the time
shouldn't hurt, and is one less test.


Modified:
   trunk/busybox/libbb/loop.c


Changeset:
Modified: trunk/busybox/libbb/loop.c
===================================================================
--- trunk/busybox/libbb/loop.c	2005-10-10 13:34:19 UTC (rev 11824)
+++ trunk/busybox/libbb/loop.c	2005-10-11 07:26:15 UTC (rev 11825)
@@ -88,10 +88,9 @@
 	int i, dfd, ffd, mode, rc=1;
 
 	// Open the file.  Barf if this doesn't work.
-	if((ffd = open(file, mode=O_RDWR))<0)
-		if(errno!=EROFS || (ffd=open(file,mode=O_RDONLY))<0)
-			return errno;
-
+	if((ffd = open(file, mode=O_RDWR))<0 && (ffd = open(file,mode=O_RDONLY))<0)
+		return errno;
+	
 	// Find a loop device
 	for(i=0;rc;i++) {
 		sprintf(dev, LOOP_FORMAT, i++);




More information about the busybox-cvs mailing list