standards/171577: realpath(3) returns ENOTDIR instead of ENOENT
Ed Maste
emaste at FreeBSD.org
Wed Sep 12 16:00:12 UTC 2012
>Number: 171577
>Category: standards
>Synopsis: realpath(3) returns ENOTDIR instead of ENOENT
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-standards
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Sep 12 16:00:08 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Ed Maste
>Release: FreeBSD 9.1-PRERELEASE amd64
>Organization:
FreeBSD
>Environment:
FreeBSD feynman 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #1 r240164M: Thu Sep 6 10:40:42 EDT 2012 emaste at feynman:/data2/emaste/obj/home/emaste/src/9/sys/TEST amd64
>Description:
When passed a path with a component that does not exist realpath() sets
errno to ENOTDIR instead of ENOENT. See kern/128933 for the change that
introduced this behaviour. I believe it is incorrect.
ENOTDIR is
20 ENOTDIR Not a directory. A component of the specified pathname
existed, but it was not a directory, when a directory was
expected.
>How-To-Repeat:
feynman% realpath /does-not-exist/foo
realpath: /does-not-exist/foo: Not a directory
>Fix:
Index: realpath.c
===================================================================
--- realpath.c (revision 240400)
+++ realpath.c (working copy)
@@ -181,8 +181,6 @@
return (NULL);
}
if (lstat(resolved, &sb) != 0) {
- if (errno != ENOENT || p != NULL)
- errno = ENOTDIR;
if (m)
free(resolved);
return (NULL);
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-standards
mailing list