Date: Wed, 12 Sep 2012 15:54:43 GMT From: Ed Maste <emaste@FreeBSD.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: standards/171577: realpath(3) returns ENOTDIR instead of ENOENT Message-ID: <201209121554.q8CFsgL4030388@freefall.freebsd.org> Resent-Message-ID: <201209121600.q8CG09Zl050812@freefall.freebsd.org>
index | next in thread | raw e-mail
>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@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:
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209121554.q8CFsgL4030388>
