Commit 808d6ac8 authored by Michael Tremer's avatar Michael Tremer

database: Improve error reporting when the magic cannot be read

Signed-off-by: default avatarMichael Tremer <michael.tremer@ipfire.org>
parent 34d537b1
......@@ -142,7 +142,7 @@ static int loc_database_read_magic(struct loc_database* db) {
if (bytes_read < sizeof(magic)) {
ERROR(db->ctx, "Could not read enough data to validate magic bytes\n");
DEBUG(db->ctx, "Read %zu bytes, but needed %zu\n", bytes_read, sizeof(magic));
return -ENOMSG;
goto ERROR;
}
// Compare magic bytes
......@@ -155,7 +155,9 @@ static int loc_database_read_magic(struct loc_database* db) {
return 0;
}
ERROR:
ERROR(db->ctx, "Unrecognized file type\n");
errno = ENOMSG;
// Return an error
return 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment