From cb638b5e96465e695eaf34859ac762236b4bcb1e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 1 Dec 2016 12:49:23 +0100 Subject: [PATCH] =?utf8?q?util-lib:=20rename=20CHASE=5FNON=5FEXISTING=20?= =?utf8?q?=E2=86=92=20CHASE=5FNONEXISTENT?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit As suggested by @keszybz --- src/basic/fs-util.c | 4 ++-- src/basic/fs-util.h | 2 +- src/nspawn/nspawn-mount.c | 8 ++++---- src/nspawn/nspawn.c | 2 +- src/test/test-fs-util.c | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c index 0ca4656..b30cec4 100644 --- a/src/basic/fs-util.c +++ b/src/basic/fs-util.c @@ -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. */ diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h index 3931534..0d925c6 100644 --- a/src/basic/fs-util.h +++ b/src/basic/fs-util.h @@ -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); diff --git a/src/nspawn/nspawn-mount.c b/src/nspawn/nspawn-mount.c index 9024ea1..c9d5ac4 100644 --- a/src/nspawn/nspawn-mount.c +++ b/src/nspawn/nspawn-mount.c @@ -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? */ diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 84c2137..ddd6a64 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -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; diff --git a/src/test/test-fs-util.c b/src/test/test-fs-util.c index 2570bc5..b502cd0 100644 --- a/src/test/test-fs-util.c +++ b/src/test/test-fs-util.c @@ -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); -- 2.7.4