mirror of
https://github.com/mdbtools/mdbtools.git
synced 2026-03-10 00:20:54 +08:00
Prints "file not found" when that happens
... rather than the obscure "Can't alloc filename"
This commit is contained in:
@@ -134,7 +134,11 @@ static char *mdb_find_file(const char *file_name)
|
|||||||
|
|
||||||
/* try the provided file name first */
|
/* try the provided file name first */
|
||||||
if (!stat(file_name, &status)) {
|
if (!stat(file_name, &status)) {
|
||||||
return g_strdup(file_name);
|
char *result;
|
||||||
|
result = g_strdup(file_name);
|
||||||
|
if (!result)
|
||||||
|
fprintf(stderr, "Can't alloc filename\n");
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now pull apart $MDBPATH and try those */
|
/* Now pull apart $MDBPATH and try those */
|
||||||
@@ -186,7 +190,7 @@ MdbHandle *mdb_open(const char *filename, MdbFileFlags flags)
|
|||||||
mdb->f->fd = -1;
|
mdb->f->fd = -1;
|
||||||
mdb->f->filename = mdb_find_file(filename);
|
mdb->f->filename = mdb_find_file(filename);
|
||||||
if (!mdb->f->filename) {
|
if (!mdb->f->filename) {
|
||||||
fprintf(stderr, "Can't alloc filename\n");
|
fprintf(stderr, "File not found\n");
|
||||||
mdb_close(mdb);
|
mdb_close(mdb);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user