public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] dwelf_elf_e_machine_string: Clear errno before calling strtol
@ 2019-11-14 13:55 Andreas Schwab
  2019-11-14 22:43 ` Mark Wielaard
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2019-11-14 13:55 UTC (permalink / raw)
  To: elfutils-devel

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."

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] dwelf_elf_e_machine_string: Clear errno before calling strtol
  2019-11-14 13:55 [PATCH] dwelf_elf_e_machine_string: Clear errno before calling strtol Andreas Schwab
@ 2019-11-14 22:43 ` Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2019-11-14 22:43 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: elfutils-devel

On Thu, Nov 14, 2019 at 02:54:58PM +0100, Andreas Schwab wrote:
> Avoid spurious failure if errno is modified by any other library call in
> the test.

Looks correct. Pushed to master.

Thanks,

Mark

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-14 22:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-14 13:55 [PATCH] dwelf_elf_e_machine_string: Clear errno before calling strtol Andreas Schwab
2019-11-14 22:43 ` Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).