mirror of
https://github.com/systemd/systemd.git
synced 2024-11-01 09:21:26 +03:00
test-fs-util: save current directory name
This commit is contained in:
parent
46e92680e0
commit
cd76d4c2fe
@ -242,6 +242,7 @@ static void test_readlink_and_make_absolute(void) {
|
||||
char name2[] = "test-readlink_and_make_absolute/original";
|
||||
char name_alias[] = "/tmp/test-readlink_and_make_absolute-alias";
|
||||
char *r = NULL;
|
||||
_cleanup_free_ char *pwd = NULL;
|
||||
|
||||
assert_se(mkdir_safe(tempdir, 0755, getuid(), getgid(), false) >= 0);
|
||||
assert_se(touch(name) >= 0);
|
||||
@ -252,6 +253,8 @@ static void test_readlink_and_make_absolute(void) {
|
||||
free(r);
|
||||
assert_se(unlink(name_alias) >= 0);
|
||||
|
||||
assert_se(pwd = get_current_dir_name());
|
||||
|
||||
assert_se(chdir(tempdir) >= 0);
|
||||
assert_se(symlink(name2, name_alias) >= 0);
|
||||
assert_se(readlink_and_make_absolute(name_alias, &r) >= 0);
|
||||
@ -259,6 +262,8 @@ static void test_readlink_and_make_absolute(void) {
|
||||
free(r);
|
||||
assert_se(unlink(name_alias) >= 0);
|
||||
|
||||
assert_se(chdir(pwd) >= 0);
|
||||
|
||||
assert_se(rm_rf(tempdir, REMOVE_ROOT|REMOVE_PHYSICAL) >= 0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user