[lkml]   [1996]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subjectpossible buglet in 2.0.17 ext_2unlink()
ext2_unlink() seems to return EPERM if one attempts to unlink() a

This seems a bit wrong, would not EISDIR be a better value? I know
that root can sometimes unlink() directories, but even so I think
EISDIR is better for non-root users.

Here's an untested patch against 2.0.17 fs/ext2/namei.c to correct it.

--- namei.c Wed Jul 10 12:11:15 1996
+++ /tmp/namei.c Fri Sep 6 00:27:54 1996
@@ -719,8 +719,10 @@
if (inode->i_sb->dq_op)
inode->i_sb->dq_op->initialize (inode, -1);
retval = -EPERM;
- if (S_ISDIR(inode->i_mode))
+ if (S_ISDIR(inode->i_mode)) {
+ retval = -EISDIR;
goto end_unlink;
+ }
if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
goto end_unlink;
if (de->inode != inode->i_ino) {
Perhaps the test should be (S_ISDIR(inode->i_mode) && fsuser()), if
root should be able to unlink directories on linux.

The same problem may affect other file system, I haven't checked.


 \ /
  Last update: 2005-03-22 13:38    [W:0.039 / U:3.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site