patch-2.2.3 linux/fs/fat/file.c

Next file: linux/fs/fat/mmap.c
Previous file: linux/fs/fat/cvf.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.2/linux/fs/fat/file.c linux/fs/fat/file.c
@@ -456,6 +456,10 @@
 	/* Why no return value?  Surely the disk could fail... */
 	if (IS_IMMUTABLE(inode))
 		return /* -EPERM */;
+	if(inode->i_sb->s_flags&MS_RDONLY) {
+		printk("FAT: fat_truncate called though fs is read-only, uhh...\n");
+		return /* -EROFS */;
+	}
 	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 (who was at: slshen@lbl.gov)