]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - support/tst-support_capture_subprocess.c
Add xchdir to libsupport.
[thirdparty/glibc.git] / support / tst-support_capture_subprocess.c
index ab363e41ac741f80bdf15e11326d0084de32b295..e662cda833240e6a92a0cf4d85348a004d6b0615 100644 (file)
@@ -1,5 +1,5 @@
 /* Test capturing output from a subprocess.
-   Copyright (C) 2017-2019 Free Software Foundation, Inc.
+   Copyright (C) 2017-2021 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
 
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
+   <https://www.gnu.org/licenses/>.  */
 
 #include <stdbool.h>
 #include <stdio.h>
@@ -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;