mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-27 03:41:23 +08:00
support: Set errno before testing it.
In test-conainer we should set errno to 0 before calling strtol, and check after with TEST_COMPARE. In tst-support_capture_subprocess we should set errno to 0 before checking it after the call to strtol. Tested on x86_64. Reviewed-by: DJ Delorie <dj@redhat.com>
This commit is contained in:
parent
df6c63ebbc
commit
183083c359
@ -940,7 +940,9 @@ main (int argc, char **argv)
|
||||
else if (nt == 3 && strcmp (the_words[0], "chmod") == 0)
|
||||
{
|
||||
long int m;
|
||||
errno = 0;
|
||||
m = strtol (the_words[1], NULL, 0);
|
||||
TEST_COMPARE (errno, 0);
|
||||
if (chmod (the_words[2], m) < 0)
|
||||
FAIL_EXIT1 ("chmod %s: %s\n",
|
||||
the_words[2], strerror (errno));
|
||||
|
@ -133,7 +133,9 @@ static int
|
||||
parse_int (const char *str)
|
||||
{
|
||||
char *endptr;
|
||||
long int ret = strtol (str, &endptr, 10);
|
||||
long int ret;
|
||||
errno = 0;
|
||||
ret = strtol (str, &endptr, 10);
|
||||
TEST_COMPARE (errno, 0);
|
||||
TEST_VERIFY (ret >= 0 && ret <= INT_MAX);
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user