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
6cd02f1d
Commit
6cd02f1d
authored
Aug 15, 2022
by
Michael Tremer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace strerror(errno) with %m in format string throughout
Signed-off-by:
Michael Tremer
<
michael.tremer@ipfire.org
>
parent
00beb796
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
20 additions
and
20 deletions
+20
-20
src/database.c
src/database.c
+6
-6
src/python/writer.c
src/python/writer.c
+2
-2
src/stringpool.c
src/stringpool.c
+2
-2
src/test-as.c
src/test-as.c
+1
-1
src/test-country.c
src/test-country.c
+1
-1
src/test-database.c
src/test-database.c
+1
-1
src/test-network.c
src/test-network.c
+1
-1
src/test-signature.c
src/test-signature.c
+5
-5
src/writer.c
src/writer.c
+1
-1
No files found.
src/database.c
View file @
6cd02f1d
...
...
@@ -436,28 +436,28 @@ static void loc_database_free(struct loc_database* db) {
if
(
db
->
as_v1
)
{
r
=
munmap
(
db
->
as_v1
,
db
->
as_count
*
sizeof
(
*
db
->
as_v1
));
if
(
r
)
ERROR
(
db
->
ctx
,
"Could not unmap AS section: %
s
\n
"
,
strerror
(
errno
)
);
ERROR
(
db
->
ctx
,
"Could not unmap AS section: %
m
\n
"
);
}
// Remove mapped network sections
if
(
db
->
networks_v1
)
{
r
=
munmap
(
db
->
networks_v1
,
db
->
networks_count
*
sizeof
(
*
db
->
networks_v1
));
if
(
r
)
ERROR
(
db
->
ctx
,
"Could not unmap networks section: %
s
\n
"
,
strerror
(
errno
)
);
ERROR
(
db
->
ctx
,
"Could not unmap networks section: %
m
\n
"
);
}
// Remove mapped network nodes section
if
(
db
->
network_nodes_v1
)
{
r
=
munmap
(
db
->
network_nodes_v1
,
db
->
network_nodes_count
*
sizeof
(
*
db
->
network_nodes_v1
));
if
(
r
)
ERROR
(
db
->
ctx
,
"Could not unmap network nodes section: %
s
\n
"
,
strerror
(
errno
)
);
ERROR
(
db
->
ctx
,
"Could not unmap network nodes section: %
m
\n
"
);
}
// Remove mapped countries section
if
(
db
->
countries_v1
)
{
r
=
munmap
(
db
->
countries_v1
,
db
->
countries_count
*
sizeof
(
*
db
->
countries_v1
));
if
(
r
)
ERROR
(
db
->
ctx
,
"Could not unmap countries section: %
s
\n
"
,
strerror
(
errno
)
);
ERROR
(
db
->
ctx
,
"Could not unmap countries section: %
m
\n
"
);
}
if
(
db
->
pool
)
...
...
@@ -498,8 +498,8 @@ LOC_EXPORT int loc_database_verify(struct loc_database* db, FILE* f) {
// Load public key
EVP_PKEY
*
pkey
=
PEM_read_PUBKEY
(
f
,
NULL
,
NULL
,
NULL
);
if
(
!
pkey
)
{
char
*
error
=
ERR_error_string
(
ERR_get_error
(),
NULL
);
ERROR
(
db
->
ctx
,
"Could not parse public key: %s
\n
"
,
error
);
ERROR
(
db
->
ctx
,
"Could not parse public key: %s
\n
"
,
ERR_error_string
(
ERR_get_error
(),
NULL
)
);
return
-
1
;
}
...
...
src/python/writer.c
View file @
6cd02f1d
...
...
@@ -227,7 +227,7 @@ static PyObject* Writer_write(WriterObject* self, PyObject* args) {
FILE
*
f
=
fopen
(
path
,
"w+"
);
if
(
!
f
)
{
PyErr_
Format
(
PyExc_IOError
,
strerror
(
errno
)
);
PyErr_
SetFromErrno
(
PyExc_OSError
);
return
NULL
;
}
...
...
@@ -236,7 +236,7 @@ static PyObject* Writer_write(WriterObject* self, PyObject* args) {
// Raise any errors
if
(
r
)
{
PyErr_
Format
(
PyExc_IOError
,
strerror
(
errno
)
);
PyErr_
SetFromErrno
(
PyExc_OSError
);
return
NULL
;
}
...
...
src/stringpool.c
View file @
6cd02f1d
...
...
@@ -119,8 +119,8 @@ static void loc_stringpool_free(struct loc_stringpool* pool) {
if
(
pool
->
data
)
{
r
=
munmap
(
pool
->
data
,
pool
->
length
);
if
(
r
)
ERROR
(
pool
->
ctx
,
"Could not unmap data at %p: %
s
\n
"
,
pool
->
data
,
strerror
(
errno
)
);
ERROR
(
pool
->
ctx
,
"Could not unmap data at %p: %
m
\n
"
,
pool
->
data
);
}
break
;
}
...
...
src/test-as.c
View file @
6cd02f1d
...
...
@@ -55,7 +55,7 @@ int main(int argc, char** argv) {
FILE
*
f
=
tmpfile
();
if
(
!
f
)
{
fprintf
(
stderr
,
"Could not open file for writing: %
s
\n
"
,
strerror
(
errno
)
);
fprintf
(
stderr
,
"Could not open file for writing: %
m
\n
"
);
exit
(
EXIT_FAILURE
);
}
...
...
src/test-country.c
View file @
6cd02f1d
...
...
@@ -124,7 +124,7 @@ int main(int argc, char** argv) {
FILE
*
f
=
tmpfile
();
if
(
!
f
)
{
fprintf
(
stderr
,
"Could not open file for writing: %
s
\n
"
,
strerror
(
errno
)
);
fprintf
(
stderr
,
"Could not open file for writing: %
m
\n
"
);
exit
(
EXIT_FAILURE
);
}
...
...
src/test-database.c
View file @
6cd02f1d
...
...
@@ -167,7 +167,7 @@ int main(int argc, char** argv) {
FILE
*
f
=
tmpfile
();
if
(
!
f
)
{
fprintf
(
stderr
,
"Could not open file for writing: %
s
\n
"
,
strerror
(
errno
)
);
fprintf
(
stderr
,
"Could not open file for writing: %
m
\n
"
);
exit
(
EXIT_FAILURE
);
}
...
...
src/test-network.c
View file @
6cd02f1d
...
...
@@ -260,7 +260,7 @@ int main(int argc, char** argv) {
FILE
*
f
=
tmpfile
();
if
(
!
f
)
{
fprintf
(
stderr
,
"Could not open file for writing: %
s
\n
"
,
strerror
(
errno
)
);
fprintf
(
stderr
,
"Could not open file for writing: %
m
\n
"
);
exit
(
EXIT_FAILURE
);
}
...
...
src/test-signature.c
View file @
6cd02f1d
...
...
@@ -34,20 +34,20 @@ int main(int argc, char** argv) {
// Open public key
FILE
*
public_key
=
fopen
(
ABS_SRCDIR
"/examples/public-key.pem"
,
"r"
);
if
(
!
public_key
)
{
fprintf
(
stderr
,
"Could not open public key file: %
s
\n
"
,
strerror
(
errno
)
);
fprintf
(
stderr
,
"Could not open public key file: %
m
\n
"
);
exit
(
EXIT_FAILURE
);
}
// Open private key
FILE
*
private_key1
=
fopen
(
ABS_SRCDIR
"/examples/private-key.pem"
,
"r"
);
if
(
!
private_key1
)
{
fprintf
(
stderr
,
"Could not open private key file: %
s
\n
"
,
strerror
(
errno
)
);
fprintf
(
stderr
,
"Could not open private key file: %
m
\n
"
);
exit
(
EXIT_FAILURE
);
}
FILE
*
private_key2
=
fopen
(
ABS_SRCDIR
"/examples/private-key.pem"
,
"r"
);
if
(
!
private_key2
)
{
fprintf
(
stderr
,
"Could not open private key file: %
s
\n
"
,
strerror
(
errno
)
);
fprintf
(
stderr
,
"Could not open private key file: %
m
\n
"
);
exit
(
EXIT_FAILURE
);
}
...
...
@@ -67,7 +67,7 @@ int main(int argc, char** argv) {
FILE
*
f
=
tmpfile
();
if
(
!
f
)
{
fprintf
(
stderr
,
"Could not open file for writing: %
s
\n
"
,
strerror
(
errno
)
);
fprintf
(
stderr
,
"Could not open file for writing: %
m
\n
"
);
exit
(
EXIT_FAILURE
);
}
...
...
@@ -96,7 +96,7 @@ int main(int argc, char** argv) {
// Open another public key
public_key
=
freopen
(
ABS_SRCDIR
"/src/signing-key.pem"
,
"r"
,
public_key
);
if
(
!
public_key
)
{
fprintf
(
stderr
,
"Could not open public key file: %
s
\n
"
,
strerror
(
errno
)
);
fprintf
(
stderr
,
"Could not open public key file: %
m
\n
"
);
exit
(
EXIT_FAILURE
);
}
...
...
src/writer.c
View file @
6cd02f1d
...
...
@@ -583,7 +583,7 @@ static int loc_writer_create_signature(struct loc_writer* writer,
size_t
bytes_read
=
fread
(
buffer
,
1
,
sizeof
(
buffer
),
f
);
if
(
ferror
(
f
))
{
ERROR
(
writer
->
ctx
,
"Error reading from file: %
s
\n
"
,
strerror
(
errno
)
);
ERROR
(
writer
->
ctx
,
"Error reading from file: %
m
\n
"
);
r
=
errno
;
goto
END
;
}
...
...
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