From: Andreas Schwab <schwab@suse.de>
To: elfutils-devel@sourceware.org
Subject: [PATCH] dwelf_elf_e_machine_string: Clear errno before calling strtol
Date: Thu, 14 Nov 2019 13:55:00 -0000 [thread overview]
Message-ID: <mvma78ywojx.fsf@suse.de> (raw)
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."
next reply other threads:[~2019-11-14 13:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-14 13:55 Andreas Schwab [this message]
2019-11-14 22:43 ` Mark Wielaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=mvma78ywojx.fsf@suse.de \
--to=schwab@suse.de \
--cc=elfutils-devel@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).