From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20055 invoked by alias); 12 Feb 2010 09:51:15 -0000 Received: (qmail 20017 invoked by uid 48); 12 Feb 2010 09:51:00 -0000 Date: Fri, 12 Feb 2010 09:51:00 -0000 From: "ludo at gnu dot org" To: glibc-bugs@sources.redhat.com Message-ID: <20100212095058.11276.ludo@gnu.org> Reply-To: sourceware-bugzilla@sourceware.org Subject: [Bug libc/11276] New: remove(3) fails when unlink(2) returns `EPERM' X-Bugzilla-Reason: CC Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2010-02/txt/msg00065.txt.bz2 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.