ccanlint: don't crash if given bad directory name.
[ccan] / tools / ccanlint / ccanlint.c
index c0ab02768c4664f4a6940ffad6358405ca83251c..7747a4976e7cd1ea748191ff5246480806cb027b 100644 (file)
@@ -681,6 +681,9 @@ int main(int argc, char *argv[])
                for (i = 1; i < argc; i++) {
                        dir = path_canon(NULL,
                                         take(path_join(NULL, cwd, argv[i])));
+                       if (!dir)
+                               err(1, "Cannot get canonical name of '%s'",
+                                   argv[i]);
 
                        prefix = path_join(NULL, ccan_dir, "ccan");
                        prefix = path_rel(NULL, take(prefix), dir);