util-lib: rename CHASE_NON_EXISTING → CHASE_NONEXISTENT
As suggested by @keszybz
This commit is contained in:
parent
ec57bd426a
commit
cb638b5e96
|
@ -711,10 +711,10 @@ int chase_symlinks(const char *path, const char *original_root, unsigned flags,
|
|||
if (child < 0) {
|
||||
|
||||
if (errno == ENOENT &&
|
||||
(flags & CHASE_NON_EXISTING) &&
|
||||
(flags & CHASE_NONEXISTENT) &&
|
||||
(isempty(todo) || path_is_safe(todo))) {
|
||||
|
||||
/* If CHASE_NON_EXISTING is set, and the path does not exist, then that's OK, return
|
||||
/* If CHASE_NONEXISTENT is set, and the path does not exist, then that's OK, return
|
||||
* what we got so far. But don't allow this if the remaining path contains "../ or "./"
|
||||
* or something else weird. */
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ int inotify_add_watch_fd(int fd, int what, uint32_t mask);
|
|||
|
||||
enum {
|
||||
CHASE_PREFIX_ROOT = 1, /* If set, the specified path will be prefixed by the specified root before beginning the iteration */
|
||||
CHASE_NON_EXISTING = 2, /* If set, it's OK if the path doesn't actually exist. */
|
||||
CHASE_NONEXISTENT = 2, /* If set, it's OK if the path doesn't actually exist. */
|
||||
};
|
||||
|
||||
int chase_symlinks(const char *path_with_prefix, const char *root, unsigned flags, char **ret);
|
||||
|
|
|
@ -587,7 +587,7 @@ int mount_all(const char *dest,
|
|||
if (!ro && (bool)(mount_table[k].mount_settings & MOUNT_APPLY_APIVFS_RO))
|
||||
continue;
|
||||
|
||||
r = chase_symlinks(mount_table[k].where, dest, CHASE_NON_EXISTING|CHASE_PREFIX_ROOT, &where);
|
||||
r = chase_symlinks(mount_table[k].where, dest, CHASE_NONEXISTENT|CHASE_PREFIX_ROOT, &where);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to resolve %s/%s: %m", dest, mount_table[k].where);
|
||||
|
||||
|
@ -686,7 +686,7 @@ static int mount_bind(const char *dest, CustomMount *m) {
|
|||
if (stat(m->source, &source_st) < 0)
|
||||
return log_error_errno(errno, "Failed to stat %s: %m", m->source);
|
||||
|
||||
r = chase_symlinks(m->destination, dest, CHASE_PREFIX_ROOT|CHASE_NON_EXISTING, &where);
|
||||
r = chase_symlinks(m->destination, dest, CHASE_PREFIX_ROOT|CHASE_NONEXISTENT, &where);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to resolve %s/%s: %m", dest, m->destination);
|
||||
if (r > 0) { /* Path exists already? */
|
||||
|
@ -748,7 +748,7 @@ static int mount_tmpfs(
|
|||
assert(dest);
|
||||
assert(m);
|
||||
|
||||
r = chase_symlinks(m->destination, dest, CHASE_PREFIX_ROOT|CHASE_NON_EXISTING, &where);
|
||||
r = chase_symlinks(m->destination, dest, CHASE_PREFIX_ROOT|CHASE_NONEXISTENT, &where);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to resolve %s/%s: %m", dest, m->destination);
|
||||
if (r == 0) { /* Doesn't exist yet? */
|
||||
|
@ -789,7 +789,7 @@ static int mount_overlay(const char *dest, CustomMount *m) {
|
|||
assert(dest);
|
||||
assert(m);
|
||||
|
||||
r = chase_symlinks(m->destination, dest, CHASE_PREFIX_ROOT|CHASE_NON_EXISTING, &where);
|
||||
r = chase_symlinks(m->destination, dest, CHASE_PREFIX_ROOT|CHASE_NONEXISTENT, &where);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to resolve %s/%s: %m", dest, m->destination);
|
||||
if (r == 0) { /* Doesn't exist yet? */
|
||||
|
|
|
@ -4135,7 +4135,7 @@ int main(int argc, char *argv[]) {
|
|||
remove_directory = true;
|
||||
|
||||
} else {
|
||||
r = chase_symlinks_and_update(&arg_directory, arg_template ? CHASE_NON_EXISTING : 0);
|
||||
r = chase_symlinks_and_update(&arg_directory, arg_template ? CHASE_NONEXISTENT : 0);
|
||||
if (r < 0)
|
||||
goto finish;
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ static void test_chase_symlinks(void) {
|
|||
|
||||
q = strjoina(temp, "/usr");
|
||||
|
||||
r = chase_symlinks(p, temp, CHASE_NON_EXISTING, &result);
|
||||
r = chase_symlinks(p, temp, CHASE_NONEXISTENT, &result);
|
||||
assert_se(r == 0);
|
||||
assert_se(path_equal(result, q));
|
||||
|
||||
|
@ -162,7 +162,7 @@ static void test_chase_symlinks(void) {
|
|||
r = chase_symlinks(p, NULL, 0, &result);
|
||||
assert_se(r == -ENOENT);
|
||||
|
||||
r = chase_symlinks(p, NULL, CHASE_NON_EXISTING, &result);
|
||||
r = chase_symlinks(p, NULL, CHASE_NONEXISTENT, &result);
|
||||
assert_se(r == 0);
|
||||
assert_se(path_equal(result, p));
|
||||
result = mfree(result);
|
||||
|
@ -171,7 +171,7 @@ static void test_chase_symlinks(void) {
|
|||
r = chase_symlinks(p, NULL, 0, &result);
|
||||
assert_se(r == -ENOENT);
|
||||
|
||||
r = chase_symlinks(p, NULL, CHASE_NON_EXISTING, &result);
|
||||
r = chase_symlinks(p, NULL, CHASE_NONEXISTENT, &result);
|
||||
assert_se(r == 0);
|
||||
assert_se(path_equal(result, p));
|
||||
result = mfree(result);
|
||||
|
@ -182,7 +182,7 @@ static void test_chase_symlinks(void) {
|
|||
r = chase_symlinks(p, NULL, 0, &result);
|
||||
assert_se(r == -ENOENT);
|
||||
|
||||
r = chase_symlinks(p, NULL, CHASE_NON_EXISTING, &result);
|
||||
r = chase_symlinks(p, NULL, CHASE_NONEXISTENT, &result);
|
||||
assert_se(r == -ENOENT);
|
||||
|
||||
assert_se(rm_rf(temp, REMOVE_ROOT|REMOVE_PHYSICAL) >= 0);
|
||||
|
|
Loading…
Reference in New Issue