Merge branch 'nd/maint-relative'
* nd/maint-relative: get_cwd_relative(): do not misinterpret root path
This commit is contained in:
commit
20cb8e2025
6
dir.c
6
dir.c
@ -1033,6 +1033,12 @@ char *get_relative_cwd(char *buffer, int size, const char *dir)
|
|||||||
case '/':
|
case '/':
|
||||||
return cwd + 1;
|
return cwd + 1;
|
||||||
default:
|
default:
|
||||||
|
/*
|
||||||
|
* dir can end with a path separator when it's root
|
||||||
|
* directory. Return proper prefix in that case.
|
||||||
|
*/
|
||||||
|
if (dir[-1] == '/')
|
||||||
|
return cwd;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user