Handle 'file not found' case

This commit is contained in:
whydoubt 2005-06-17 02:39:45 +00:00
parent 6bec184d98
commit e6c4050c74
2 changed files with 14 additions and 8 deletions

View File

@ -1,6 +1,7 @@
Thu Jun 16 21:19:37 CDT 2005 Jeff Smith <whydoubt@yahoo.com>
* src/libmdb/data.c: Fix segmentation fault
* src/libmdb/write.c: Fix bug in handling certain 'jump tables'
* src/util/mdb-schema.c: Handle 'file not found' case
Mon May 2 07:28:58 CDT 2005 Jeff Smith <whydoubt@yahoo.com>
* include/mdbtools.h:

View File

@ -62,18 +62,23 @@ main (int argc, char **argv)
}
}
mdb_init();
mdb_init();
/* open the database */
mdb = mdb_open (argv[optind], MDB_NOFLAGS);
if (argc - optind >= 2) {
if (!mdb_set_default_backend(mdb, argv[optind + 1])) {
fprintf(stderr,"Invalid backend type\n");
/* open the database */
mdb = mdb_open (argv[optind], MDB_NOFLAGS);
if (!mdb) {
fprintf(stderr, "Could not open file\n");
mdb_exit();
exit(1);
}
}
if (argc - optind >= 2) {
if (!mdb_set_default_backend(mdb, argv[optind + 1])) {
fprintf(stderr, "Invalid backend type\n");
mdb_exit();
exit(1);
}
}
/* read the catalog */
if (!mdb_read_catalog (mdb, MDB_TABLE)) {