patch-1.3.40 linux/fs/msdos/file.c

Next file: linux/fs/msdos/inode.c
Previous file: linux/fs/msdos/dir.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.39/linux/fs/msdos/file.c linux/fs/msdos/file.c
@@ -6,8 +6,6 @@
  *  MS-DOS regular file handling primitives
  */
 
-#include <linux/module.h>
-
 #include <linux/sched.h>
 #include <linux/locks.h>
 #include <linux/fs.h>
@@ -285,6 +283,8 @@
 		printk("msdos_file_write: mode = %07o\n",inode->i_mode);
 		return -EINVAL;
 	}
+	/* Must not harm system files */
+	if (MSDOS_I(inode)->i_attrs & ATTR_SYS) return -EPERM;
 /*
  * ok, append may not work when many processes are writing at the same time
  * but so what. That way leads to madness anyway.
@@ -362,6 +362,9 @@
 {
 	int cluster;
 
+	/* Must not harm system files */
+	/* Why no return value?  Surely the disk could fail... */
+	if (MSDOS_I(inode)->i_attrs & ATTR_SYS) return /* -EPERM */;
 	cluster = SECTOR_SIZE*MSDOS_SB(inode->i_sb)->cluster_size;
 	(void) fat_free(inode,(inode->i_size+(cluster-1))/cluster);
 	MSDOS_I(inode)->i_attrs |= ATTR_ARCH;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this