diff --git a/src/database.c b/src/database.c index a62d7ff..54d4431 100644 --- a/src/database.c +++ b/src/database.c @@ -162,7 +162,10 @@ int imdb_write_rec(imdb_t *db, imdb_rec_t *rec) DB_SEEK(db, rec->num * IMDB_REC_LEN); DB_WRITE(db, rec->data, IMDB_REC_LEN); - return bytes / IMDB_REC_LEN; + if (bytes != IMDB_REC_LEN) + return -1; + + return 1; } int imdb_read_blk(imdb_t *db, imdb_block_t *blk)