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
47dfa832
Commit
47dfa832
authored
Aug 22, 2022
by
Michael Tremer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
database: Log any errors when mmap() fails
Signed-off-by:
Michael Tremer
<
michael.tremer@ipfire.org
>
parent
06b88d93
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
src/database.c
src/database.c
+12
-4
No files found.
src/database.c
View file @
47dfa832
...
...
@@ -172,8 +172,10 @@ static int loc_database_read_as_section_v1(struct loc_database* db,
db
->
as_v1
=
mmap
(
NULL
,
as_length
,
PROT_READ
,
MAP_PRIVATE
,
fileno
(
db
->
f
),
as_offset
);
if
(
db
->
as_v1
==
MAP_FAILED
)
if
(
db
->
as_v1
==
MAP_FAILED
)
{
ERROR
(
db
->
ctx
,
"Could not mmap() AS section: %m
\n
"
);
return
1
;
}
}
db
->
as_count
=
as_length
/
sizeof
(
*
db
->
as_v1
);
...
...
@@ -195,8 +197,10 @@ static int loc_database_read_network_nodes_section_v1(struct loc_database* db,
db
->
network_nodes_v1
=
mmap
(
NULL
,
network_nodes_length
,
PROT_READ
,
MAP_PRIVATE
,
fileno
(
db
->
f
),
network_nodes_offset
);
if
(
db
->
network_nodes_v1
==
MAP_FAILED
)
if
(
db
->
network_nodes_v1
==
MAP_FAILED
)
{
ERROR
(
db
->
ctx
,
"Could not mmap() network nodes section: %m
\n
"
);
return
1
;
}
}
db
->
network_nodes_count
=
network_nodes_length
/
sizeof
(
*
db
->
network_nodes_v1
);
...
...
@@ -218,8 +222,10 @@ static int loc_database_read_networks_section_v1(struct loc_database* db,
db
->
networks_v1
=
mmap
(
NULL
,
networks_length
,
PROT_READ
,
MAP_PRIVATE
,
fileno
(
db
->
f
),
networks_offset
);
if
(
db
->
networks_v1
==
MAP_FAILED
)
if
(
db
->
networks_v1
==
MAP_FAILED
)
{
ERROR
(
db
->
ctx
,
"Could not mmap() networks section: %m
\n
"
);
return
1
;
}
}
db
->
networks_count
=
networks_length
/
sizeof
(
*
db
->
networks_v1
);
...
...
@@ -241,8 +247,10 @@ static int loc_database_read_countries_section_v1(struct loc_database* db,
db
->
countries_v1
=
mmap
(
NULL
,
countries_length
,
PROT_READ
,
MAP_PRIVATE
,
fileno
(
db
->
f
),
countries_offset
);
if
(
db
->
countries_v1
==
MAP_FAILED
)
if
(
db
->
countries_v1
==
MAP_FAILED
)
{
ERROR
(
db
->
ctx
,
"Could not mmap() countries section: %m
\n
"
);
return
1
;
}
}
db
->
countries_count
=
countries_length
/
sizeof
(
*
db
->
countries_v1
);
...
...
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