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.
This commit is contained in:
Bruce Evans 1995-02-25 16:06:07 +00:00
parent 386094e305
commit 5dddb8148b

View File

@ -98,7 +98,7 @@ realpath(path, resolved)
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)