Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libloc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
libloc
Commits
808d6ac8
Commit
808d6ac8
authored
Aug 22, 2022
by
Michael Tremer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
database: Improve error reporting when the magic cannot be read
Signed-off-by:
Michael Tremer
<
michael.tremer@ipfire.org
>
parent
34d537b1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
src/database.c
src/database.c
+3
-1
No files found.
src/database.c
View file @
808d6ac8
...
@@ -142,7 +142,7 @@ static int loc_database_read_magic(struct loc_database* db) {
...
@@ -142,7 +142,7 @@ static int loc_database_read_magic(struct loc_database* db) {
if
(
bytes_read
<
sizeof
(
magic
))
{
if
(
bytes_read
<
sizeof
(
magic
))
{
ERROR
(
db
->
ctx
,
"Could not read enough data to validate magic bytes
\n
"
);
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
));
DEBUG
(
db
->
ctx
,
"Read %zu bytes, but needed %zu
\n
"
,
bytes_read
,
sizeof
(
magic
));
return
-
ENOMSG
;
goto
ERROR
;
}
}
// Compare magic bytes
// Compare magic bytes
...
@@ -155,7 +155,9 @@ static int loc_database_read_magic(struct loc_database* db) {
...
@@ -155,7 +155,9 @@ static int loc_database_read_magic(struct loc_database* db) {
return
0
;
return
0
;
}
}
ERROR:
ERROR
(
db
->
ctx
,
"Unrecognized file type
\n
"
);
ERROR
(
db
->
ctx
,
"Unrecognized file type
\n
"
);
errno
=
ENOMSG
;
// Return an error
// Return an error
return
1
;
return
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment