X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fccanlint%2Fccanlint.c;h=42da05afad85719a09ebe66f9bb0d9849608d96b;hp=8acad9329e4c7280d0fef58eb8b833cf9ca7cd72;hb=1f45ec04761cd99011445c6d41cd64a3951f77e0;hpb=2b46b6e66a6a842923640c881cd235166a4c9ad5 diff --git a/tools/ccanlint/ccanlint.c b/tools/ccanlint/ccanlint.c index 8acad932..42da05af 100644 --- a/tools/ccanlint/ccanlint.c +++ b/tools/ccanlint/ccanlint.c @@ -292,12 +292,21 @@ static void init_tests(void) } } +static int show_tmpdir(char *dir) +{ + printf("You can find ccanlint working files in '%s'\n", dir); + return 0; +} + static char *keep_test(const char *testname, void *unused) { struct ccanlint *i = find_test(testname); if (!i) errx(1, "No test %s to --keep", testname); i->keep_results = true; + + /* Don't automatically destroy temporary dir. */ + talloc_set_destructor(temp_dir(NULL), show_tmpdir); return NULL; } @@ -495,6 +504,10 @@ int main(int argc, char *argv[]) " of CCAN modules.", "This usage message"); + /* We move into temporary directory, so gcov dumps its files there. */ + if (chdir(temp_dir(talloc_autofree_context())) != 0) + err(1, "Error changing to %s temporary dir", temp_dir(NULL)); + opt_parse(&argc, argv, opt_log_stderr_exit); if (dir[0] != '/') @@ -508,10 +521,6 @@ int main(int argc, char *argv[]) if (verbose >= 4) tools_verbose = true; - /* We move into temporary directory, so gcov dumps its files there. */ - if (chdir(temp_dir(talloc_autofree_context())) != 0) - err(1, "Error changing to %s temporary dir", temp_dir(NULL)); - m = get_manifest(talloc_autofree_context(), dir); /* Create a symlink from temp dir back to src dir's test directory. */