[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Again: access permissions with tosfs



 There is still a bug left in MH-MiNT 1.12.1 in the computation of
access-permissions under tosfs. If the user did not do a chmod() yet
the permissions should be computated just as if ROOTPERMS was not
defined.
 This patch should fix it. It is relative to MH-MiNT 1.12.1

Bjarne
-----------------------------cut--------------------------------

--- ..\tmp\tosfs.c	Sat Nov 26 17:48:24 1994
+++ tosfs.c	Sat Nov 26 17:50:10 1994
@@ -646,10 +646,9 @@
 	if (tp) {
 		xattr->uid = tp->uid;
 		xattr->gid = tp->gid;
-	}
-#else
-	xattr->uid = xattr->gid = 0;
+	} else
 #endif
+	xattr->uid = xattr->gid = 0;
 
 #ifndef NEWWAY
 	ti->stamp = ++tclock;
@@ -709,15 +708,16 @@
 
 		if (!(ti->attr & FA_DIR) && !(ti->attr & FA_EXEC))
 			xattr->mode &= ~(S_IXUSR|S_IXGRP|S_IXOTH);
-	}
-#else
-	if (ti->attr & FA_EXEC) {
-		xattr->mode |= (S_IXUSR|S_IXGRP);
-	}
-
-	/* TOS files have permissions rwxrwx--- */
-	xattr->mode &= ~(S_IROTH|S_IWOTH|S_IXOTH);
+	} else
 #endif
+	{
+		if (ti->attr & FA_EXEC) {
+			xattr->mode |= (S_IXUSR|S_IXGRP);
+		}
+
+		/* TOS files have permissions rwxrwx--- */
+		xattr->mode &= ~(S_IROTH|S_IWOTH|S_IXOTH);
+	}
 
 	if (ti->attr & FA_RDONLY) {
 		xattr->mode &= ~(S_IWUSR|S_IWGRP|S_IWOTH);