Lines Matching refs:p
34 const char *top, *p, *pslash, *q, *qslash; in TEST() local
44 p = strjoina(top, "/dot"); in TEST()
45 if (symlink(".", p) < 0) { in TEST()
51 p = strjoina(top, "/dotdot"); in TEST()
52 assert_se(symlink("..", p) >= 0); in TEST()
54 p = strjoina(top, "/dotdota"); in TEST()
55 assert_se(symlink("../a", p) >= 0); in TEST()
57 p = strjoina(temp, "/a"); in TEST()
58 assert_se(symlink("b", p) >= 0); in TEST()
60 p = strjoina(temp, "/b"); in TEST()
61 assert_se(symlink("/usr", p) >= 0); in TEST()
63 p = strjoina(temp, "/start"); in TEST()
64 assert_se(symlink("top/dot/dotdota", p) >= 0); in TEST()
68 r = chase_symlinks(p, NULL, 0, &result, NULL); in TEST()
73 pslash = strjoina(p, "/"); in TEST()
79 r = chase_symlinks(p, temp, 0, &result, NULL); in TEST()
87 r = chase_symlinks(p, temp, CHASE_NONEXISTENT, &result, NULL); in TEST()
101 r = chase_symlinks(p, temp, 0, &result, NULL); in TEST()
111 p = strjoina(temp, "/slash"); in TEST()
112 assert_se(symlink("/", p) >= 0); in TEST()
114 r = chase_symlinks(p, NULL, 0, &result, NULL); in TEST()
119 r = chase_symlinks(p, temp, 0, &result, NULL); in TEST()
126 p = strjoina(temp, "/6dots"); in TEST()
127 assert_se(symlink("../../..", p) >= 0); in TEST()
129 r = chase_symlinks(p, temp, 0, &result, NULL); in TEST()
133 p = strjoina(temp, "/6dotsusr"); in TEST()
134 assert_se(symlink("../../../usr", p) >= 0); in TEST()
136 r = chase_symlinks(p, temp, 0, &result, NULL); in TEST()
140 p = strjoina(temp, "/top/8dotsusr"); in TEST()
141 assert_se(symlink("../../../../usr", p) >= 0); in TEST()
143 r = chase_symlinks(p, temp, 0, &result, NULL); in TEST()
149 p = strjoina(temp, "/slashslash"); in TEST()
150 assert_se(symlink("///usr///", p) >= 0); in TEST()
152 r = chase_symlinks(p, NULL, 0, &result, NULL); in TEST()
158 r = chase_symlinks(p, temp, 0, &result, NULL); in TEST()
166 p = strjoina(temp, "/user"); in TEST()
167 assert_se(mkdir(p, 0755) >= 0); in TEST()
168 assert_se(chown(p, UID_NOBODY, GID_NOBODY) >= 0); in TEST()
173 p = strjoina(q, "/link"); in TEST()
174 assert_se(symlink("/", p) >= 0); in TEST()
177 r = chase_symlinks(p, temp, CHASE_SAFE, &result, NULL); in TEST()
182 r = chase_symlinks(p, q, CHASE_SAFE, &result, NULL); in TEST()
224 p = strjoina(temp, "/recursive-symlink"); in TEST()
225 assert_se(symlink("recursive-symlink", p) >= 0); in TEST()
226 r = chase_symlinks(p, NULL, 0, &result, NULL); in TEST()
231 p = strjoina(temp, "/idontexist"); in TEST()
232 r = chase_symlinks(p, NULL, 0, &result, NULL); in TEST()
235 r = chase_symlinks(p, NULL, CHASE_NONEXISTENT, &result, NULL); in TEST()
237 assert_se(path_equal(result, p)); in TEST()
240 p = strjoina(temp, "/idontexist/meneither"); in TEST()
241 r = chase_symlinks(p, NULL, 0, &result, NULL); in TEST()
244 r = chase_symlinks(p, NULL, CHASE_NONEXISTENT, &result, NULL); in TEST()
246 assert_se(path_equal(result, p)); in TEST()
251 p = strjoina(temp, "/idontexist/.."); in TEST()
252 r = chase_symlinks(p, NULL, 0, &result, NULL); in TEST()
255 r = chase_symlinks(p, NULL, CHASE_NONEXISTENT, &result, NULL); in TEST()
258 p = strjoina(temp, "/target"); in TEST()
260 assert_se(symlink(q, p) >= 0); in TEST()
261 p = strjoina(temp, "/target/idontexist"); in TEST()
262 r = chase_symlinks(p, NULL, 0, &result, NULL); in TEST()
266 p = strjoina(temp, "/priv1"); in TEST()
267 assert_se(mkdir(p, 0755) >= 0); in TEST()
269 q = strjoina(p, "/priv2"); in TEST()
277 assert_se(chown(p, UID_NOBODY, GID_NOBODY) >= 0); in TEST()
287 assert_se(chown(p, 0, 0) >= 0); in TEST()
291 p = strjoina(temp, "/machine-id-test"); in TEST()
292 assert_se(symlink("/usr/../etc/./machine-id", p) >= 0); in TEST()
294 r = chase_symlinks(p, NULL, 0, NULL, &pfd); in TEST()
312 p = strjoina(temp, "/target"); in TEST()
314 assert_se(symlink(p, q) >= 0); in TEST()
327 p = strjoina(temp, "/s2"); in TEST()
328 assert_se(symlink("nonexistent", p) >= 0); in TEST()
340 p = strjoina(temp, "/start"); in TEST()
341 r = chase_symlinks(p, NULL, CHASE_STEP, &result, NULL); in TEST()
343 p = strjoina(temp, "/top/dot/dotdota"); in TEST()
344 assert_se(streq(p, result)); in TEST()
347 r = chase_symlinks(p, NULL, CHASE_STEP, &result, NULL); in TEST()
349 p = strjoina(temp, "/top/dotdota"); in TEST()
350 assert_se(streq(p, result)); in TEST()
353 r = chase_symlinks(p, NULL, CHASE_STEP, &result, NULL); in TEST()
355 p = strjoina(temp, "/top/../a"); in TEST()
356 assert_se(streq(p, result)); in TEST()
359 r = chase_symlinks(p, NULL, CHASE_STEP, &result, NULL); in TEST()
361 p = strjoina(temp, "/a"); in TEST()
362 assert_se(streq(p, result)); in TEST()
365 r = chase_symlinks(p, NULL, CHASE_STEP, &result, NULL); in TEST()
367 p = strjoina(temp, "/b"); in TEST()
368 assert_se(streq(p, result)); in TEST()
371 r = chase_symlinks(p, NULL, CHASE_STEP, &result, NULL); in TEST()
382 p = strjoina("/etc/..", temp, "/self"); in TEST()
383 assert_se(symlink(".", p) >= 0); in TEST()
384 q = strjoina(p, "/top/dot/dotdota"); in TEST()
385 r = chase_symlinks(q, p, 0, &result, NULL); in TEST()
387 assert_se(path_equal(path_startswith(result, p), "usr")); in TEST()
523 _cleanup_(rmdir_and_freep) char *p = NULL; in TEST()
528 assert_se(mkdtemp_malloc(a, &p) >= 0); in TEST()
530 fd = open(p, O_RDONLY|O_DIRECTORY|O_CLOEXEC); in TEST()
552 _cleanup_(rm_rf_physical_and_freep) char *p = NULL; in TEST()
564 assert_se(mkdtemp_malloc(a, &p) >= 0); in TEST()
566 a = strjoina(p, "/regular"); in TEST()
581 a = strjoina(p, "/dir"); in TEST()
591 a = strjoina(p, "/fifo"); in TEST()
601 a = strjoina(p, "/sock"); in TEST()
612 a = strjoina(p, "/bdev"); in TEST()
627 a = strjoina(p, "/cdev"); in TEST()
638 a = strjoina(p, "/lnk"); in TEST()
649 _cleanup_free_ char *p = NULL; in TEST() local
653 assert_se(tempfn_random_child(arg_test_dir, "unlink-deallocation", &p) >= 0); in TEST()
655 fd = open(p, O_WRONLY|O_CLOEXEC|O_CREAT|O_EXCL, 0600); in TEST()
665 assert_se(unlinkat_deallocate(AT_FDCWD, p, UNLINK_ERASE) >= 0); in TEST()
751 const char *p; in TEST() local
760 p = strjoina(d, "/reg"); in TEST()
761 assert_se(mknod(p, S_IFREG | 0123, 0) >= 0); in TEST()
763 assert_se(chmod_and_chown(p, S_IFREG | 0321, 1, 2) >= 0); in TEST()
764 assert_se(chmod_and_chown(p, S_IFDIR | 0555, 3, 4) == -EINVAL); in TEST()
766 assert_se(lstat(p, &st) >= 0); in TEST()
770 p = strjoina(d, "/dir"); in TEST()
771 assert_se(mkdir(p, 0123) >= 0); in TEST()
773 assert_se(chmod_and_chown(p, S_IFDIR | 0321, 1, 2) >= 0); in TEST()
774 assert_se(chmod_and_chown(p, S_IFREG | 0555, 3, 4) == -EINVAL); in TEST()
776 assert_se(lstat(p, &st) >= 0); in TEST()
780 p = strjoina(d, "/lnk"); in TEST()
781 assert_se(symlink("idontexist", p) >= 0); in TEST()
783 assert_se(chmod_and_chown(p, S_IFLNK | 0321, 1, 2) >= 0); in TEST()
784 assert_se(chmod_and_chown(p, S_IFREG | 0555, 3, 4) == -EINVAL); in TEST()
785 assert_se(chmod_and_chown(p, S_IFDIR | 0555, 3, 4) == -EINVAL); in TEST()
787 assert_se(lstat(p, &st) >= 0); in TEST()
791 static void create_binary_file(const char *p, const void *data, size_t l) { in create_binary_file() argument
794 fd = open(p, O_CREAT|O_WRONLY|O_EXCL|O_CLOEXEC, 0600); in create_binary_file()
800 _cleanup_(unlink_and_freep) char *p = NULL; in TEST()
807 assert_se(tempfn_random_child(NULL, NULL, &p) >= 0); in TEST()
808 create_binary_file(p, buffer, l); in TEST()
813 assert_se(link(p, q) >= 0); in TEST()
814 assert_se(conservative_renameat(AT_FDCWD, q, AT_FDCWD, p) == 0); in TEST()
818 assert_se(copy_file(p, q, 0, MODE_INVALID, 0, 0, COPY_REFLINK) >= 0); in TEST()
819 assert_se(conservative_renameat(AT_FDCWD, q, AT_FDCWD, p) == 0); in TEST()
824 assert_se(conservative_renameat(AT_FDCWD, q, AT_FDCWD, p) == 0); in TEST()
830 assert_se(conservative_renameat(AT_FDCWD, q, AT_FDCWD, p) > 0); in TEST()
835 assert_se(conservative_renameat(AT_FDCWD, q, AT_FDCWD, p) == 0); in TEST()
841 assert_se(conservative_renameat(AT_FDCWD, q, AT_FDCWD, p) > 0); in TEST()
847 assert_se(conservative_renameat(AT_FDCWD, q, AT_FDCWD, p) > 0); in TEST()
859 const char *p, *s; in test_rmdir_parents_one() local
863 p = strjoina(prefix, path); in test_rmdir_parents_one()
867 assert_se(mkdir_parents(p, 0700) >= 0); in test_rmdir_parents_one()
869 assert_se(rmdir_parents(p, s) == expected); in test_rmdir_parents_one()