diff options
| author | Amaury Pouly <amaury.pouly@gmail.com> | 2012-02-19 18:36:57 +0100 |
|---|---|---|
| committer | Amaury Pouly <amaury.pouly@gmail.com> | 2012-02-19 18:36:57 +0100 |
| commit | c483905b9244646e89bc36940da7ea5a65e37392 (patch) | |
| tree | 4006357666d2a614bce1303df5eeabf4c51d8168 /utils/imxtools/dbparser.c | |
| parent | 2d7a4e9dfaee0fc82561bc19c65647b05ad3e0d5 (diff) | |
| download | rockbox-c483905b9244646e89bc36940da7ea5a65e37392.zip rockbox-c483905b9244646e89bc36940da7ea5a65e37392.tar.gz rockbox-c483905b9244646e89bc36940da7ea5a65e37392.tar.bz2 rockbox-c483905b9244646e89bc36940da7ea5a65e37392.tar.xz | |
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
Diffstat (limited to 'utils/imxtools/dbparser.c')
| -rw-r--r-- | utils/imxtools/dbparser.c | 12 |
1 files changed, 10 insertions, 2 deletions
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) |