From c483905b9244646e89bc36940da7ea5a65e37392 Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Sun, 19 Feb 2012 18:36:57 +0100 Subject: imxtools: remove most calls to bug/bugp from core library. It should not exit() anymore on error except on malloc failure. Resource leaks on errors (especially I/O) are quite likely though. Change-Id: I6fcf72fb08fc683468b390d0b8745d31ca982b48 --- utils/imxtools/dbparser.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'utils/imxtools/dbparser.c') diff --git a/utils/imxtools/dbparser.c b/utils/imxtools/dbparser.c index b2027e5..89a63b3 100644 --- a/utils/imxtools/dbparser.c +++ b/utils/imxtools/dbparser.c @@ -460,13 +460,21 @@ struct cmd_file_t *db_parse_file(const char *file) size_t size; FILE *f = fopen(file, "r"); if(f == NULL) - bugp("Cannot open file '%s'", file); + { + if(g_debug) + perror("Cannot open db file"); + return NULL; + } fseek(f, 0, SEEK_END); size = ftell(f); fseek(f, 0, SEEK_SET); char *buf = xmalloc(size); if(fread(buf, size, 1, f) != 1) - bugp("Cannot read file '%s'", file); + { + if(g_debug) + perror("Cannot read db file"); + return NULL; + } fclose(f); if(g_debug) -- cgit v1.1