This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[PATCH] dwelf_elf_e_machine_string: Clear errno before calling strtol
- From: Andreas Schwab <schwab at suse dot de>
- To: elfutils-devel at sourceware dot org
- Date: Thu, 14 Nov 2019 14:54:58 +0100
- Subject: [PATCH] dwelf_elf_e_machine_string: Clear errno before calling strtol
Avoid spurious failure if errno is modified by any other library call in
the test.
Signed-off-by: Andreas Schwab <schwab@suse.de>
---
tests/ChangeLog | 5 +++++
tests/dwelf_elf_e_machine_string.c | 1 +
2 files changed, 6 insertions(+)
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 97b8dedb..5b8a6224 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,8 @@
+2019-11-14 Andreas Schwab <schwab@suse.de>
+
+ * dwelf_elf_e_machine_string.c (main): Clear errno before calling
+ strtol.
+
2019-09-02 Mark Wielaard <mark@klomp.org>
* run-readelf-s.sh: Add --dyn-syms case.
diff --git a/tests/dwelf_elf_e_machine_string.c b/tests/dwelf_elf_e_machine_string.c
index 1df2b233..afad1058 100644
--- a/tests/dwelf_elf_e_machine_string.c
+++ b/tests/dwelf_elf_e_machine_string.c
@@ -40,6 +40,7 @@ main (int argc, char **argv)
int em;
const char *machine;
+ errno = 0;
if (strncmp ("0x", argv[i], 2) == 0)
val = strtol (&argv[i][2], NULL, 16);
else
--
2.24.0
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."