From 6c4f1d9e131457fa4881e792eef61d42d02c0da9 Mon Sep 17 00:00:00 2001 From: emaste Date: Tue, 18 Sep 2012 13:03:00 +0000 Subject: [PATCH] MFC r240410: Avoid mapping ENOENT to ENOTDIR for non-existent path components. The ENOTDIR mapping was introduced in r235266 for kern/128933 based on an interpretation of the somewhat ambiguous language in the POSIX realpath specification. The interpretation is inconsistent with Solaris and Linux, a regression from 9.0, and does not appear to be permitted by the description of ENOTDIR: 20 ENOTDIR Not a directory. A component of the specified pathname existed, but it was not a directory, when a directory was expected. PR: standards/171577 Approved by: re Sponsored by: ADARA Networks git-svn-id: svn://svn.freebsd.org/base/releng/9.1@240647 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- lib/libc/stdlib/realpath.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/libc/stdlib/realpath.c b/lib/libc/stdlib/realpath.c index aded9b24..8fd5457a 100644 --- a/lib/libc/stdlib/realpath.c +++ b/lib/libc/stdlib/realpath.c @@ -181,8 +181,6 @@ realpath(const char * __restrict path, char * __restrict resolved) return (NULL); } if (lstat(resolved, &sb) != 0) { - if (errno != ENOENT || p != NULL) - errno = ENOTDIR; if (m) free(resolved); return (NULL); -- 2.42.0