chase: add two more assertions

When 'need_absolute' is true, 'done' should always contain "/" at the
beginning, and thus should not be NULL.
This commit is contained in:
Yu Watanabe
2023-07-29 21:58:30 +09:00
parent b7e957d30f
commit 1c13bdf342
+2
View File
@@ -449,6 +449,7 @@ int chaseat(int dir_fd, const char *path, ChaseFlags flags, char **ret_path, int
}
if (!done) {
assert(!need_absolute || FLAGS_SET(flags, CHASE_EXTRACT_FILENAME));
done = strdup(append_trail_slash ? "./" : ".");
if (!done)
return -ENOMEM;
@@ -475,6 +476,7 @@ chased_one:
const char *e;
if (!done) {
assert(!need_absolute);
done = strdup(append_trail_slash ? "./" : ".");
if (!done)
return -ENOMEM;