From: Mike Gelfand Date: Mon, 3 Sep 2018 22:05:16 +0000 (+0300) Subject: Fix file-test on Win32 due to file/dir symlinks difference X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a53bae2849f5709ffafec8ab6505ca4002ca5309;p=transmission Fix file-test on Win32 due to file/dir symlinks difference --- diff --git a/libtransmission/file-test.c b/libtransmission/file-test.c index 02dfd5ff4..73dd5f1c0 100644 --- a/libtransmission/file-test.c +++ b/libtransmission/file-test.c @@ -243,10 +243,12 @@ static int test_get_info(void) tr_sys_file_close(fd, NULL); tr_sys_path_remove(path2, NULL); + tr_sys_path_remove(path1, NULL); /* Good directory info */ t = time(NULL); tr_sys_dir_create(path2, 0, 0777, NULL); + check(create_symlink(path1, path2, true)); /* Win32: directory and file symlinks differ :( */ clear_path_info(&info); check(tr_sys_path_get_info(path1, 0, &info, &err)); check_ptr(err, ==, NULL); @@ -310,9 +312,11 @@ static int test_path_exists(void) check_ptr(err, ==, NULL); tr_sys_path_remove(path2, NULL); + tr_sys_path_remove(path1, NULL); /* Create directory and see that it exists (via symlink) */ tr_sys_dir_create(path2, 0, 0777, NULL); + check(create_symlink(path1, path2, true)); /* Win32: directory and file symlinks differ :( */ check(tr_sys_path_exists(path1, &err)); check_ptr(err, ==, NULL); @@ -615,9 +619,11 @@ static int test_path_resolve(void) check(path_contains_no_symlinks(tmp)); tr_free(tmp); + tr_sys_path_remove(path2, NULL); tr_sys_path_remove(path1, NULL); - tr_sys_dir_create(path1, 0, 0755, NULL); + tr_sys_dir_create(path1, 0, 0755, NULL); + check(create_symlink(path2, path1, true)); /* Win32: directory and file symlinks differ :( */ tmp = tr_sys_path_resolve(path2, &err); check_str(tmp, !=, NULL); check_ptr(err, ==, NULL);