path-util: make iterator for path_find_last_component() always finish with the beginning of the buffer
This commit is contained in:
@@ -901,6 +901,8 @@ static const char *skip_slash_or_dot_backward(const char *path, const char *q) {
|
||||
continue;
|
||||
if (q > path && strneq(q - 1, "/.", 2))
|
||||
continue;
|
||||
if (q == path && *q == '.')
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
return q;
|
||||
@@ -925,6 +927,12 @@ int path_find_last_component(const char *path, bool accept_dot_dot, const char *
|
||||
* ret: "bbbbb/cc//././"
|
||||
* return value: 5 (== strlen("bbbbb"))
|
||||
*
|
||||
* Input: path: "//.//aaa///bbbbb/cc//././"
|
||||
* next: "///bbbbb/cc//././"
|
||||
* Output: next: "//.//aaa///bbbbb/cc//././" (next == path)
|
||||
* ret: "aaa///bbbbb/cc//././"
|
||||
* return value: 3 (== strlen("aaa"))
|
||||
*
|
||||
* Input: path: "/", ".", "", or NULL
|
||||
* Output: next: equivalent to path
|
||||
* ret: NULL
|
||||
|
||||
Reference in New Issue
Block a user