[Top][All Lists]

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

[Bug libc/11276] New: remove(3) fails when unlink(2) returns `EPERM'

From: ludo at gnu dot org
Subject: [Bug libc/11276] New: remove(3) fails when unlink(2) returns `EPERM'
Date: 12 Feb 2010 09:51:00 -0000

Currently sysdeps/posix/remove.c reads this:

remove (file)
     const char *file;
  /* First try to unlink since this is more frequently the necessary action. */
  if (__unlink (file) != 0
      /* If it is indeed a directory...  */
      && (errno != EISDIR
          /* ...try to remove it.  */
          || __rmdir (file) != 0))
    /* Cannot remove the object for whatever reason.  */
    return -1;

  return 0;

However, POSIX says unlink(2) returns `EPERM' when PATH is a directory. `EISDIR'
is Linux-specific and the "Rationale" section at
http://www.opengroup.org/onlinepubs/9699919799/functions/unlink.html says that
"[a]pplications written for portability to both POSIX.1-2008 and the LSB should
be prepared to handle either error code."

Currently remove(3) fails on GNU/Hurd [0] and GNU/kFreeBSD [1] because of this.
 Thus it should be changed to handle both `EPERM' and `EISDIR'.

[0] https://savannah.gnu.org/bugs/?28859
[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=557248

           Summary: remove(3) fails when unlink(2) returns `EPERM'
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: ludo at gnu dot org
                CC: bug-hurd at gnu dot org,glibc-bugs at sources dot redhat
                    dot com
  GCC host triplet: i386-unknown-gnu0.3


------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

reply via email to

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