diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-09-23 17:51:08 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2020-09-23 18:00:19 +0200 |
commit | 1e5bfa2ac8bffc4e53b596b77f0dbdec0bba281a (patch) | |
tree | 70829b90ecc31ff8287c33c1273589411ad1ebbd /src/test/test-fs-util.c | |
parent | sysusers: modernize file backup logic a bit (diff) | |
download | systemd-1e5bfa2ac8bffc4e53b596b77f0dbdec0bba281a.tar.xz systemd-1e5bfa2ac8bffc4e53b596b77f0dbdec0bba281a.zip |
fs-util: drop chmod_and_chown_unsafe() which is unused now
Diffstat (limited to '')
-rw-r--r-- | src/test/test-fs-util.c | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/src/test/test-fs-util.c b/src/test/test-fs-util.c index f2df2e35e6..f63b1f5d5f 100644 --- a/src/test/test-fs-util.c +++ b/src/test/test-fs-util.c @@ -802,50 +802,6 @@ static void test_chmod_and_chown(void) { assert_se(S_ISLNK(st.st_mode)); } -static void test_chmod_and_chown_unsafe(void) { - _cleanup_(rm_rf_physical_and_freep) char *d = NULL; - _unused_ _cleanup_umask_ mode_t u = umask(0000); - struct stat st; - const char *p; - - if (geteuid() != 0) - return; - - log_info("/* %s */", __func__); - - assert_se(mkdtemp_malloc(NULL, &d) >= 0); - - p = strjoina(d, "/reg"); - assert_se(mknod(p, S_IFREG | 0123, 0) >= 0); - - assert_se(chmod_and_chown_unsafe(p, S_IFREG | 0321, 1, 2) >= 0); - assert_se(chmod_and_chown_unsafe(p, S_IFDIR | 0555, 3, 4) == -EINVAL); - - assert_se(lstat(p, &st) >= 0); - assert_se(S_ISREG(st.st_mode)); - assert_se((st.st_mode & 07777) == 0321); - - p = strjoina(d, "/dir"); - assert_se(mkdir(p, 0123) >= 0); - - assert_se(chmod_and_chown_unsafe(p, S_IFDIR | 0321, 1, 2) >= 0); - assert_se(chmod_and_chown_unsafe(p, S_IFREG | 0555, 3, 4) == -EINVAL); - - assert_se(lstat(p, &st) >= 0); - assert_se(S_ISDIR(st.st_mode)); - assert_se((st.st_mode & 07777) == 0321); - - p = strjoina(d, "/lnk"); - assert_se(symlink("idontexist", p) >= 0); - - assert_se(chmod_and_chown_unsafe(p, S_IFLNK | 0321, 1, 2) >= 0); - assert_se(chmod_and_chown_unsafe(p, S_IFREG | 0555, 3, 4) == -EINVAL); - assert_se(chmod_and_chown_unsafe(p, S_IFDIR | 0555, 3, 4) == -EINVAL); - - assert_se(lstat(p, &st) >= 0); - assert_se(S_ISLNK(st.st_mode)); -} - static void test_path_is_encrypted_one(const char *p, int expect) { int r; @@ -895,7 +851,6 @@ int main(int argc, char *argv[]) { test_fsync_directory_of_file(); test_rename_noreplace(); test_chmod_and_chown(); - test_chmod_and_chown_unsafe(); test_path_is_encrypted(); return 0; |