about summary refs log tree commit diff
path: root/support/test-container.c
diff options
context:
space:
mode:
authorCarlos O'Donell <carlos@redhat.com>2020-04-29 16:31:29 -0400
committerCarlos O'Donell <carlos@redhat.com>2020-04-30 16:28:07 -0400
commit183083c35972611e7786c7ee0c96d7da571631ed (patch)
tree29b7a4b0b8dc911419d302aa0a0bfdbe94cd4d3e /support/test-container.c
parentdf6c63ebbce9679e755f0ecc716a33babee5d008 (diff)
downloadglibc-183083c35972611e7786c7ee0c96d7da571631ed.tar.gz
glibc-183083c35972611e7786c7ee0c96d7da571631ed.tar.xz
glibc-183083c35972611e7786c7ee0c96d7da571631ed.zip
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>
Diffstat (limited to 'support/test-container.c')
-rw-r--r--support/test-container.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/support/test-container.c b/support/test-container.c
index 08d5195b7e..afc23db148 100644
--- a/support/test-container.c
+++ b/support/test-container.c
@@ -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));