1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Amaury Pouly 2012-02-19 18:36:57 +01:00
parent 2d7a4e9dfa
commit c483905b92
6 changed files with 50 additions and 14 deletions

View file

@ -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)