Bug 8479 - unlink() on a dir sets errno to EISDIR; SUS expects EPERM
Summary: unlink() on a dir sets errno to EISDIR; SUS expects EPERM
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kernel
Version: 6.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Michael K. Johnson
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-01-14 21:08 UTC by Jay Turner
Modified: 2015-01-07 23:40 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2000-01-14 21:08:24 UTC


Attachments (Terms of Use)

Description Glen Foster 2000-01-14 21:08:24 UTC
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 19:00:02 UTC
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.