patch-2.4.9 linux/fs/open.c

Next file: linux/fs/partitions/Config.in
Previous file: linux/fs/ntfs/util.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.8/linux/fs/open.c linux/fs/open.c
@@ -847,3 +847,18 @@
 	}
 	return -EPERM;
 }
+
+/*
+ * Called when an inode is about to be open.
+ * We use this to disallow opening RW large files on 32bit systems if
+ * the caller didn't specify O_LARGEFILE.  On 64bit systems we force
+ * on this flag in sys_open.
+ */
+int generic_file_open(struct inode * inode, struct file * filp)
+{
+	if (!(filp->f_flags & O_LARGEFILE) && inode->i_size > MAX_NON_LFS)
+		return -EFBIG;
+	return 0;
+}
+
+EXPORT_SYMBOL(generic_file_open);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)