]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
absolute path fix
authorArshan Khanifar <arshankhanifar@gmail.com>
Wed, 7 Feb 2018 17:59:57 +0000 (12:59 -0500)
committerArshan Khanifar <arshankhanifar@gmail.com>
Wed, 7 Feb 2018 17:59:57 +0000 (12:59 -0500)
tar/test/test_option_C_mtree.c

index fb644a411e8bfe71d9f7347efc0388241eb80fb7..dc2692ac9971c66d5e7145898d8ae53a42633504 100644 (file)
@@ -33,19 +33,24 @@ DEFINE_TEST(test_option_C_mtree)
        char *p0;
        size_t s;
        int r;
-
        p0 = NULL;
-
        char *content = "./foo type=file uname=root gname=root mode=0755\n";
+       char *filename = "output.tar";
 
+       /* an absolute path to mtree file */ 
+       char *mtree_file = "/METALOG.mtree";    
+       char *absolute_path = malloc(strlen(testworkdir) + strlen(mtree_file) + 1);
+       strcpy(absolute_path, testworkdir);
+       strcat(absolute_path, mtree_file );
+       
        /* Create an archive using an mtree file. */
-       assertMakeFile("/tmp/METALOG.mtree", 0777, content);
+       assertMakeFile(absolute_path, 0777, content);
        assertMakeDir("bar", 0775);
        assertMakeFile("bar/foo", 0777, "abc");
 
-       r = systemf("%s -cf output.tar -C bar @/tmp/METALOG.mtree >step1.out 2>step1.err", testprog);
+       r = systemf("%s -cf %s -C bar @%s >step1.out 2>step1.err", testprog, filename, absolute_path);
 
-       failure("Error invoking %s -cf output.tar -C bar @/tmp/METALOG.mtree", testprog);
+       failure("Error invoking %s -cf %s -C bar @%s", testprog, filename, absolute_path);
        assertEqualInt(r, 0);
        assertEmptyFile("step1.out");
        assertEmptyFile("step1.err");