This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/11276] New: remove(3) fails when unlink(2) returns `EPERM'
- From: "ludo at gnu dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 12 Feb 2010 09:51:00 -0000
- Subject: [Bug libc/11276] New: remove(3) fails when unlink(2) returns `EPERM'
- Reply-to: sourceware-bugzilla at sourceware dot org
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.