summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2019-06-28 10:50:01 +0200
committerPatrick Steinhardt <ps@pks.im>2019-07-05 11:58:33 +0200
commit69055813046366967563e0b78ee29113ef610886 (patch)
tree633c6c0fefb401e5de166dce6efa1deefa91a2c7
parent48d563286c788f344dd97feba1b06da6b4b42ac0 (diff)
downloadlibgit2-69055813046366967563e0b78ee29113ef610886.tar.gz
fuzzers: make printf formatters cross-platform compatible
The `printf` formatters in our standalone fuzzing driver are currently using the "%m" specifier, which is a GNU extension that prints the error message for the error code in `errno`. As we're using libgit2 functions in both cases anyway, let's just use `git_error_last` instead to make this valid on all platforms.
-rw-r--r--fuzzers/standalone_driver.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fuzzers/standalone_driver.c b/fuzzers/standalone_driver.c
index 000bfbfa4..e8ce3fd07 100644
--- a/fuzzers/standalone_driver.c
+++ b/fuzzers/standalone_driver.c
@@ -24,7 +24,7 @@ static int run_one_file(const char *filename)
int error = 0;
if (git_futils_readbuffer(&buf, filename) < 0) {
- fprintf(stderr, "Failed to read %s: %m\n", filename);
+ fprintf(stderr, "Failed to read %s: %s\n", filename, git_error_last()->message);
error = -1;
goto exit;
}
@@ -57,7 +57,8 @@ int main(int argc, char **argv)
LLVMFuzzerInitialize(&argc, &argv);
if (git_path_dirload(&corpus_files, argv[1], 0, 0x0) < 0) {
- fprintf(stderr, "Failed to scan corpus directory: %m\n");
+ fprintf(stderr, "Failed to scan corpus directory '%s': %s\n",
+ argv[1], git_error_last()->message);
error = -1;
goto exit;
}