summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1995-02-25 16:06:07 +0000
committerbde <bde@FreeBSD.org>1995-02-25 16:06:07 +0000
commit17a5fa641ede870f78ea93174d7e0fdf3554b523 (patch)
tree6c465518461b807028655496e6a9ff44e69338e8 /lib
parent856bb9e15f70bc1b5492320d4ed5922d1468ad26 (diff)
downloadFreeBSD-src-17a5fa641ede870f78ea93174d7e0fdf3554b523.zip
FreeBSD-src-17a5fa641ede870f78ea93174d7e0fdf3554b523.tar.gz
Don't attempt to lstat() the POSIXLY invalid empty pathname.
realpath() still accepts "" as an arg and converts it to a canonical pathname for the current directory.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/stdlib/realpath.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/stdlib/realpath.c b/lib/libc/stdlib/realpath.c
index 20efabd..28380d7 100644
--- a/lib/libc/stdlib/realpath.c
+++ b/lib/libc/stdlib/realpath.c
@@ -98,7 +98,7 @@ loop:
p = resolved;
/* Deal with the last component. */
- if (lstat(p, &sb) == 0) {
+ if (*p != '\0' && lstat(p, &sb) == 0) {
if (S_ISLNK(sb.st_mode)) {
n = readlink(p, resolved, MAXPATHLEN);
if (n < 0)
OpenPOWER on IntegriCloud