diff options
author | bde <bde@FreeBSD.org> | 1995-02-25 16:06:07 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1995-02-25 16:06:07 +0000 |
commit | 17a5fa641ede870f78ea93174d7e0fdf3554b523 (patch) | |
tree | 6c465518461b807028655496e6a9ff44e69338e8 /lib/libc/stdlib/realpath.c | |
parent | 856bb9e15f70bc1b5492320d4ed5922d1468ad26 (diff) | |
download | FreeBSD-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/libc/stdlib/realpath.c')
-rw-r--r-- | lib/libc/stdlib/realpath.c | 2 |
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) |