]> git.ozlabs.org Git - ccan/commitdiff
ccanlint: don't crash if given bad directory name.
authorRusty Russell <rusty@rustcorp.com.au>
Sun, 31 Mar 2013 06:40:50 +0000 (17:10 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Sun, 31 Mar 2013 06:40:50 +0000 (17:10 +1030)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
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])));
                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);
 
                        prefix = path_join(NULL, ccan_dir, "ccan");
                        prefix = path_rel(NULL, take(prefix), dir);