patch-1.3.67 linux/fs/fat/inode.c

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

diff -u --recursive --new-file v1.3.66/linux/fs/fat/inode.c linux/fs/fat/inode.c
@@ -358,6 +358,15 @@
 	return (cluster-2)*sb->cluster_size+sb->data_start+offset;
 }
 
+static int is_exec(char *extension)
+{
+	char *exe_extensions = "EXECOMBAT", *walk;
+
+	for (walk = exe_extensions; *walk; walk += 3)
+		if (!strncmp(extension, walk, 3))
+			return 1;
+	return 0;
+}
 
 void fat_read_inode(struct inode *inode, struct inode_operations *fs_dir_inode_ops)
 {
@@ -424,7 +433,8 @@
 			}
 	} else { /* not a directory */
 		inode->i_mode = MSDOS_MKMODE(raw_entry->attr,
-		    (IS_NOEXEC(inode) ? S_IRUGO|S_IWUGO : S_IRWXUGO)
+		    ((IS_NOEXEC(inode) || !is_exec(raw_entry->ext))
+		    	? S_IRUGO|S_IWUGO : S_IRWXUGO)
 		    & ~MSDOS_SB(inode->i_sb)->fs_umask) | S_IFREG;
 		inode->i_op = (sb->s_blocksize == 1024)
 			? &fat_file_inode_operations_1024

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