Fix stripping last path component when only one path component left.

PR:		52686
MFC after:	1 day
This commit is contained in:
Max Khon 2003-05-28 08:23:01 +00:00
parent 34d258e905
commit f4203da86c

View File

@ -119,7 +119,7 @@ realpath(const char *path, char resolved[PATH_MAX])
*/
if (resolved_len > 1) {
resolved[resolved_len - 1] = '\0';
q = strrchr(resolved, '/');
q = strrchr(resolved, '/') + 1;
*q = '\0';
resolved_len = q - resolved;
}
@ -158,7 +158,7 @@ realpath(const char *path, char resolved[PATH_MAX])
} else if (resolved_len > 1) {
/* Strip the last path component. */
resolved[resolved_len - 1] = '\0';
q = strrchr(resolved, '/');
q = strrchr(resolved, '/') + 1;
*q = '\0';
resolved_len = q - resolved;
}