]> granicus.if.org Git - transmission/commitdiff
Fix file-test on Win32 due to file/dir symlinks difference
authorMike Gelfand <mikedld@mikedld.com>
Mon, 3 Sep 2018 22:05:16 +0000 (01:05 +0300)
committerMike Gelfand <mikedld@mikedld.com>
Mon, 3 Sep 2018 22:06:21 +0000 (01:06 +0300)
libtransmission/file-test.c

index 02dfd5ff4211da9e4da640f6e209eee39c3d981b..73dd5f1c0c4c36598261c8f767e1a5d2da03348d 100644 (file)
@@ -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);