bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: remove() vs. directories


From: Petr Salinger
Subject: Re: remove() vs. directories
Date: Fri, 20 Nov 2009 23:30:19 +0100 (CET)

Debian bug report: <http://bugs.debian.org/557248>.

Actually, the same change is needed for the Hurd; we also do return EPERM
for unlink("[directory]").  Roland, what's your preference to fix this?

IMO, the really proper fix would be to use variant with EPERM only in
sysdeps/posix/remove.c
and the variant with EISDIR only in
sysdeps/unix/sysv/linux/remove.c

The reasonable fix would be use patch bellow.

But given usual drepper's answers like
http://sourceware.org/ml/glibc-bugs/2009-11/msg00116.html
it have been much easier for us (GNU/FreeBSD) just create own variant ...

Petr

--- sysdeps/posix/remove.c
+++ sysdeps/posix/remove.c
@@ -28,7 +28,8 @@
/* First try to unlink since this is more frequently the necessary action. */
   if (__unlink (file) != 0
       /* If it is indeed a directory...  */
-      && (errno != EISDIR
+      /* Linux returns EISDIR, POSIX mandates EPERM */
+      && (((errno != EISDIR) && (errno != EPERM))
          /* ...try to remove it.  */
          || __rmdir (file) != 0))
     /* Cannot remove the object for whatever reason.  */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]