]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
r625 uncovered a few places where const was needed.
authorTim Kientzle <kientzle@gmail.com>
Sun, 15 Feb 2009 21:46:15 +0000 (16:46 -0500)
committerTim Kientzle <kientzle@gmail.com>
Sun, 15 Feb 2009 21:46:15 +0000 (16:46 -0500)
In particular, the refdir and testprog variables should have been const.

SVN-Revision: 626

tar/test/main.c
tar/test/test.h

index a2aa08c1dd5c56610b19366d8c36652300d726f6..7bb16f7bc2c1bb9c1d8fcc73ae3c27cb6c6fd34a 100644 (file)
@@ -84,7 +84,7 @@ static int skips = 0;
 static int assertions = 0;
 
 /* Directory where uuencoded reference files can be found. */
-static char *refdir;
+static const char *refdir;
 
 /*
  * My own implementation of the standard assert() macro emits the
@@ -901,10 +901,12 @@ int main(int argc, char **argv)
        int i, tests_run = 0, tests_failed = 0, opt;
        time_t now;
        char *refdir_alloc = NULL;
-       char *opt_arg, *progname, *p;
+       const char *opt_arg, *progname, *p;
        char tmpdir[256];
        char tmpdir_timestamp[256];
 
+       (void)argc; /* UNUSED */
+
        /*
         * Name of this program, used to build root of our temp directory
         * tree.
@@ -1019,12 +1021,14 @@ int main(int argc, char **argv)
         * reference files, use the current directory for that.
         */
        if (refdir == NULL) {
+               char *q;
                systemf("/bin/pwd > %s/refdir", tmpdir);
-               refdir = refdir_alloc = slurpfile(NULL, "%s/refdir", tmpdir);
-               p = refdir + strlen(refdir);
-               while (p[-1] == '\n') {
-                       --p;
-                       *p = '\0';
+               q = slurpfile(NULL, "%s/refdir", tmpdir);
+               refdir = refdir_alloc = q;
+               q += strlen(refdir);
+               while (q[-1] == '\n') {
+                       --q;
+                       *q = '\0';
                }
                systemf("rm %s/refdir", tmpdir);
        }
index f050004aba65b1eeeb18f53d43ed64fb59b0c8d8..3c8c00fa636d991484d51fc1cf2c2cf13a74a03b 100644 (file)
@@ -151,4 +151,4 @@ void extract_reference_file(const char *);
  */
 
 /* Pathname of exe to be tested. */
-char *testprog;
+const char *testprog;