mirror of
https://github.com/opnsense/src.git
synced 2026-04-22 06:39:32 -04:00
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
1 changed files with 2 additions and 2 deletions
|
|
@ -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 a new issue