public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/11276] New: remove(3) fails when unlink(2) returns `EPERM'
@ 2010-02-12  9:51 ludo at gnu dot org
  2010-04-04  9:09 ` [Bug libc/11276] " drepper at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: ludo at gnu dot org @ 2010-02-12  9:51 UTC (permalink / raw)
  To: glibc-bugs

Currently sysdeps/posix/remove.c reads this:

#v+
int
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;
}
#v-

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


http://sourceware.org/bugzilla/show_bug.cgi?id=11276

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


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

end of thread, other threads:[~2010-04-04  9:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-12  9:51 [Bug libc/11276] New: remove(3) fails when unlink(2) returns `EPERM' ludo at gnu dot org
2010-04-04  9:09 ` [Bug libc/11276] " drepper at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).