public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch-2.4.0-test12-pre6] truncate(2) permissions
@ 2000-12-06  9:11 Tigran Aivazian
  2000-12-06  9:44 ` Tigran Aivazian
  2000-12-06 19:46 ` Linus Torvalds
  0 siblings, 2 replies; 16+ messages in thread
From: Tigran Aivazian @ 2000-12-06  9:11 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-kernel, torvalds

Hi ALexander,

This patch combines your previous patch with 2 changes I have just
suggested. Both changes are obvious (and correct).

(correction to my previous message -- the immutable thing to return EPERM
is not just a good idea, it is imperative and Linux already does that --
so we can drop that check from if() unconditionally, which is what the
patch below does).

Tested under 2.4.0-test12-pre6.

Regards,
Tigran

--- linux/fs/open.c	Thu Oct 26 16:11:21 2000
+++ work/fs/open.c	Wed Dec  6 08:05:43 2000
@@ -102,7 +102,12 @@
 		goto out;
 	inode = nd.dentry->d_inode;
 
-	error = -EACCES;
+	/* For directories it's -EISDIR, for other non-regulars - -EINVAL */
+	error = -EISDIR;
+	if (S_ISDIR(inode->i_mode))
+		goto dput_and_out;
+
+	error = -EINVAL;
 	if (!S_ISREG(inode->i_mode))
 		goto dput_and_out;
 
@@ -110,12 +115,8 @@
 	if (error)
 		goto dput_and_out;
 
-	error = -EROFS;
-	if (IS_RDONLY(inode))
-		goto dput_and_out;
-
 	error = -EPERM;
-	if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
+	if (IS_APPEND(inode))
 		goto dput_and_out;
 
 	/*
@@ -163,7 +164,7 @@
 		goto out;
 	dentry = file->f_dentry;
 	inode = dentry->d_inode;
-	error = -EACCES;
+	error = -EINVAL;
 	if (!S_ISREG(inode->i_mode) || !(file->f_mode & FMODE_WRITE))
 		goto out_putf;
 	error = -EPERM;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: [patch] Re: [patch-2.4.0-test12-pre6] truncate(2) permissions
@ 2000-12-08  2:35 Andries.Brouwer
  2000-12-08  2:59 ` Alexander Viro
  0 siblings, 1 reply; 16+ messages in thread
From: Andries.Brouwer @ 2000-12-08  2:35 UTC (permalink / raw)
  To: aeb, viro; +Cc: linux-kernel

> BTW, if you still have 1.7, 1.10, 1.13 and 1.14...

See ftp://ftp.cwi.nl/pub/aeb/manpages/ (will soon disappear again).

> BTW, could we finally lose mpx(2)?

Maybe we lost it - I find sys_mpx only in a comment in arch/arm/kernel/calls.S

Andries
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2000-12-08 11:46 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-12-06  9:11 [patch-2.4.0-test12-pre6] truncate(2) permissions Tigran Aivazian
2000-12-06  9:44 ` Tigran Aivazian
2000-12-06 19:46 ` Linus Torvalds
2000-12-06 22:38   ` Alexander Viro
2000-12-07 10:18     ` [patch] " Tigran Aivazian
2000-12-07 10:53       ` Tigran Aivazian
2000-12-07 13:23       ` Alexander Viro
2000-12-07 13:48         ` Tigran Aivazian
2000-12-07 15:03         ` Tigran Aivazian
2000-12-07 15:24           ` Alexander Viro
2000-12-07 16:16             ` Andries Brouwer
2000-12-07 22:15               ` Alexander Viro
2000-12-07 16:06         ` Andries Brouwer
  -- strict thread matches above, loose matches on Subject: below --
2000-12-08  2:35 Andries.Brouwer
2000-12-08  2:59 ` Alexander Viro
2000-12-08 11:25   ` Marko Kreen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox