Fix stripping last path component when only one path component left.
PR: 52686 MFC after: 1 day
This commit is contained in:
parent
34d258e905
commit
f4203da86c
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user