Bug 8479 - unlink() on a dir sets errno to EISDIR; SUS expects EPERM
unlink() on a dir sets errno to EISDIR; SUS expects EPERM
Status: CLOSED DEFERRED
Product: Red Hat Linux
Classification: Retired
Component: kernel (Show other bugs)
6.1
All Linux
medium Severity medium
: ---
: ---
Assigned To: Michael K. Johnson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-01-14 16:08 EST by Jay Turner
Modified: 2015-01-07 18:40 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-01-14 16:08:24 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Glen Foster 2000-01-14 16:08:24 EST
VSX-PCTS tests the errno returned from an unlink() call on a directory.
Although Linux's setting of errno = EISDIR is *informative*, the Single
Unix Specification requires errno to be set to EPERM for implementations
that do not support unlink() operating on a directory.  See SUS for more
details.  A simple test-case is set up below...

#include <stdio.h>
#include <errno.h>

#define DIRNAME "./testdir"

main()
{
        if (mkdir(DIRNAME, 0755) < 0) {
                perror(DIRNAME);
                exit(1);
        }
        if (unlink(DIRNAME) < 0 && errno == EPERM) {
                exit(0);
        }
        perror("unlink");
        fprintf(stderr, "Expected errno %d, received %d\n", EPERM, errno);
        exit(1);
}
Comment 1 Alan Cox 2000-08-08 15:00:02 EDT
This probably wont be changing for 2.2 since it may break compatibility.

Note You need to log in before you can comment on or make changes to this bug.