chase: Allow passing NULL as the empty path to chaseat()

Per coding style, we should accept NULL as the empty path.
This commit is contained in:
Daan De Meyer
2023-06-06 14:42:03 +02:00
parent f5dc1adc71
commit 3c8f449cc8
2 changed files with 4 additions and 1 deletions
-1
View File
@@ -81,7 +81,6 @@ int chaseat(int dir_fd, const char *path, ChaseFlags flags, char **ret_path, int
const char *todo;
int r;
assert(path);
assert(!FLAGS_SET(flags, CHASE_PREFIX_ROOT));
assert(!FLAGS_SET(flags, CHASE_STEP|CHASE_EXTRACT_FILENAME));
assert(!FLAGS_SET(flags, CHASE_TRAIL_SLASH|CHASE_EXTRACT_FILENAME));
+4
View File
@@ -570,6 +570,10 @@ TEST(chaseat) {
assert_se(streq(result, "."));
result = mfree(result);
assert_se(chaseat(tfd, NULL, CHASE_PARENT|CHASE_AT_RESOLVE_IN_ROOT|CHASE_EXTRACT_FILENAME, &result, NULL) >= 0);
assert_se(streq(result, "."));
result = mfree(result);
/* Test chase_and_openat() */
fd = chase_and_openat(tfd, "o/p/e/n/f/i/l/e", CHASE_MKDIR_0755, O_CREAT|O_EXCL|O_CLOEXEC, NULL);