summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2019-07-05 05:04:27 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2019-07-05 05:04:27 +0000
commit2337963869b5423ae57976598e9556b9ad47306e (patch)
tree6ed5d0aa7113ed6f616a1c2bdcff4519bed29bf9 /lib/libc/stdlib
parent53ee8b30f1ce9f6e0d8202bfff38f18f3a39a051 (diff)
The last consumer of pre-posix realpath behaviour has stopped
requiring it (sftp-server). Remove the /exists///// behaviour from here. The /nonexistant behaviour remains in the kernel and needs to be shot next. There may be ports fallout, but we doubt it. ok beck djm
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r--lib/libc/stdlib/realpath.c37
1 files changed, 3 insertions, 34 deletions
diff --git a/lib/libc/stdlib/realpath.c b/lib/libc/stdlib/realpath.c
index 0d44430d057..f7ac9fe6060 100644
--- a/lib/libc/stdlib/realpath.c
+++ b/lib/libc/stdlib/realpath.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: realpath.c,v 1.26 2019/06/17 03:13:17 deraadt Exp $ */
+/* $OpenBSD: realpath.c,v 1.27 2019/07/05 05:04:26 deraadt Exp $ */
/*
* Copyright (c) 2019 Bob Beck <beck@openbsd.org>
* Copyright (c) 2019 Theo de Raadt <deraadt@openbsd.org>
@@ -36,39 +36,8 @@ realpath(const char *path, char *resolved)
{
char rbuf[PATH_MAX];
- if (__realpath(path, rbuf) == -1) {
- /*
- * XXX XXX XXX
- *
- * The old userland implementation strips trailing slashes.
- * According to Dr. POSIX, realpathing "/bsd" should be fine,
- * realpathing "/bsd/" should return ENOTDIR.
- *
- * Similar, but *different* to the above, The old userland
- * implementation allows for realpathing "/nonexistent" but
- * not "/nonexistent/", Both those should return ENOENT
- * according to POSIX.
- *
- * This hack should go away once we decide to match POSIX.
- * which we should as soon as is convenient.
- */
- if (errno == ENOTDIR) {
- char pbuf[PATH_MAX];
- ssize_t i;
-
- if (strlcpy(pbuf, path, sizeof(pbuf)) >= sizeof(pbuf)) {
- errno = ENAMETOOLONG;
- return NULL;
- }
- /* Try again without the trailing slashes. */
- for (i = strlen(pbuf); i > 1 && pbuf[i - 1] == '/'; i--)
- pbuf[i - 1] = '\0';
- if (__realpath(pbuf, rbuf) == -1)
- return NULL;
- } else
- return NULL;
- }
-
+ if (__realpath(path, rbuf) == -1)
+ return NULL;
if (resolved == NULL)
return (strdup(rbuf));
strlcpy(resolved, rbuf, PATH_MAX);