From 3d35a3e623a8690aa7a32335f04da9d60b999872 Mon Sep 17 00:00:00 2001 From: netblue30 Date: Sun, 22 Mar 2020 08:54:16 -0400 Subject: fix profstats to print warning for nonexistent include files --- src/profstats/main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/profstats') diff --git a/src/profstats/main.c b/src/profstats/main.c index 775142643..76b90f01b 100644 --- a/src/profstats/main.c +++ b/src/profstats/main.c @@ -48,6 +48,9 @@ static int arg_privatetmp = 0; static int arg_whitelistvar = 0; static int arg_ssh = 0; +static char *profile = NULL; + + static void usage(void) { printf("proftool - print profile statistics\n"); printf("Usage: proftool [options] file[s]\n"); @@ -74,8 +77,9 @@ void process_file(const char *fname) { FILE *fp = fopen(fname, "r"); if (!fp) { - fprintf(stderr, "Error: cannot open %s\n", fname); - exit(1); + fprintf(stderr, "Warning: cannot open %s, while processing %s\n", fname, profile); + level--; + return; } char buf[MAXBUF]; @@ -187,6 +191,7 @@ int main(int argc, char **argv) { int ssh = cnt_ssh; // process file + profile = argv[i]; process_file(argv[i]); // warnings -- cgit v1.2.3-54-g00ecf