]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/tests/depends_exist.c
ccanlint: handle when _info doesn't compile.
[ccan] / tools / ccanlint / tests / depends_exist.c
index 3d50a063a243c857bd79179c21dae0eba118955d..f69a08e432b4a91951f79c23735c11a1705e384b 100644 (file)
@@ -1,7 +1,7 @@
 #include <tools/ccanlint/ccanlint.h>
 #include <tools/tools.h>
-#include <ccan/talloc/talloc.h>
 #include <ccan/str/str.h>
+#include <ccan/tal/path/path.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -31,14 +31,12 @@ static bool add_dep(struct manifest *m,
 {
        struct stat st;
        struct manifest *subm;
-       char *dir = talloc_asprintf(m, "%s/%s", ccan_dir, dep);
+       char *dir = path_join(m, ccan_dir, dep);
 
        /* FIXME: get_manifest has a tendency to exit. */
        if (stat(dir, &st) != 0) {
-               score->error
-                       = talloc_asprintf(m,
-                                         "Could not stat dependency %s: %s",
-                                         dir, strerror(errno));
+               score->error = tal_fmt(m, "Could not stat dependency %s: %s",
+                                      dir, strerror(errno));
                return false;
        }
        subm = get_manifest(m, dir);
@@ -59,6 +57,11 @@ static void check_depends_exist(struct manifest *m,
                deps = get_deps(m, m->dir, "depends", true,
                                get_or_compile_info);
 
+       if (!deps) {
+               score->error = tal_fmt(m, "Could not extract dependencies");
+               return;
+       }
+
        for (i = 0; deps[i]; i++) {
                if (!strstarts(deps[i], "ccan/"))
                        continue;