]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/tests/license_exists.c
ccanlint: fix _info option handling
[ccan] / tools / ccanlint / tests / license_exists.c
index 965a159ff8fff53f15bea96d4675c052eedbd9f0..1ae27dd35266e6a7ca1fd9f55626dae69587a37e 100644 (file)
@@ -11,7 +11,7 @@
 #include <ccan/talloc/talloc.h>
 #include <ccan/str/str.h>
 
 #include <ccan/talloc/talloc.h>
 #include <ccan/str/str.h>
 
-struct ccanlint has_license;
+REGISTER_TEST(license_exists);
 
 static struct doc_section *find_license(const struct manifest *m)
 {
 
 static struct doc_section *find_license(const struct manifest *m)
 {
@@ -90,7 +90,7 @@ static void check_has_license(struct manifest *m,
 
        d = find_license(m);
        if (!d) {
 
        d = find_license(m);
        if (!d) {
-               score->error = "No License: tag in _info";
+               score->error = talloc_strdup(score, "No License: tag in _info");
                return;
        }
        expected = expected_link(m, d);
                return;
        }
        expected = expected_link(m, d);
@@ -111,9 +111,10 @@ static void check_has_license(struct manifest *m,
                        return;
                }
                if (errno == ENOENT) {
                        return;
                }
                if (errno == ENOENT) {
-                       score->error = "LICENSE does not exist";
+                       score->error = talloc_strdup(score,
+                                                    "LICENSE does not exist");
                        if (expected)
                        if (expected)
-                               has_license.handle = handle_license_link;
+                               license_exists.handle = handle_license_link;
                        return;
                }
                err(1, "readlink on %s", license);
                        return;
                }
                err(1, "readlink on %s", license);
@@ -155,5 +156,3 @@ struct ccanlint license_exists = {
        .check = check_has_license,
        .needs = "info_exists"
 };
        .check = check_has_license,
        .needs = "info_exists"
 };
-
-REGISTER_TEST(license_exists);