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

[MiNT] FreeMiNT patch - fchmod readonly check



Missing check for readonly access.

Alan.
Index: sys/dosfile.c
===================================================================
RCS file: /mint/freemint/sys/dosfile.c,v
retrieving revision 1.29
diff -u -r1.29 dosfile.c
--- sys/dosfile.c	27 Jun 2008 14:05:44 -0000	1.29
+++ sys/dosfile.c	28 Jun 2008 09:51:31 -0000
@@ -1084,6 +1086,12 @@
 		return ENOSYS;
 	}
 
+	if ((f->flags & O_RWMODE) == O_RDONLY)
+	{
+		DEBUG (("Ffchown: write on a read-only handle"));
+		return EPERM;
+	}
+
 	/* MiNT acts like _POSIX_CHOWN_RESTRICTED: a non-privileged process
 	 * can only change the ownership of a file that is owned by this
 	 * user, to the effective group id of the process or one of its