From 5dddb8148b1b03724e670d3870b8029be79e9449 Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Sat, 25 Feb 1995 16:06:07 +0000 Subject: 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. --- lib/libc/stdlib/realpath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/libc/stdlib/realpath.c') diff --git a/lib/libc/stdlib/realpath.c b/lib/libc/stdlib/realpath.c index 20efabdd28c0..28380d72183a 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) -- cgit v1.2.3