diff --git a/src/database.h b/src/database.h index c5eaa51..808e9c3 100644 --- a/src/database.h +++ b/src/database.h @@ -26,7 +26,6 @@ typedef struct { int fd; int flags; char path[PATH_MAX]; - char error[256]; } imdb_db_t; /** diff --git a/src/imdb-query.c b/src/imdb-query.c index 8717e68..946d931 100644 --- a/src/imdb-query.c +++ b/src/imdb-query.c @@ -54,7 +54,7 @@ int search_similar(imdb_db_t *db, uint64_t number, float maxdiff) sample.num = number; if ((ret = imdb_search(db, &sample, &search, &matches)) < 0) { - fprintf(stderr, "%s\n", db->error); + fprintf(stderr, "%s\n", imdb_error(ret)); return 1; } diff --git a/src/imdb-write.c b/src/imdb-write.c index 9cfb911..99c03b5 100644 --- a/src/imdb-write.c +++ b/src/imdb-write.c @@ -86,14 +86,14 @@ int main(int argc, char **argv) fprintf(stderr, "sampler failure\n"); exit(EXIT_FAILURE); } - if (imdb_write_rec(db, &rec) < 1) { - fprintf(stderr, "%s\n", db->error); + if ((err = imdb_write_rec(db, &rec)) < 1) { + fprintf(stderr, "%s\n", imdb_error(err)); exit(EXIT_FAILURE); } break; case del : - if (imdb_write_rec(db, &rec) < 1) { - fprintf(stderr, "%s\n", db->error); + if ((err = imdb_write_rec(db, &rec)) < 1) { + fprintf(stderr, "%s\n", imdb_error(err)); exit(EXIT_FAILURE); } break;