]> Savannah Git Hosting - gnulib.git/commitdiff
execute-tests: Fix compilation error with MSVC.
authorBruno Haible <bruno@clisp.org>
Sat, 12 Dec 2020 02:55:48 +0000 (03:55 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 12 Dec 2020 02:56:32 +0000 (03:56 +0100)
* tests/test-execute-child.c (is_device): With _fstat, use
'struct _stat', not 'struct stat'.

ChangeLog
tests/test-execute-child.c

index 78aa40ab3f84129c8b7f23341357a226eb4d5247..764f5546f975dc8ef95b3dec8dc96f91fbdc9d29 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-12-11  Bruno Haible  <bruno@clisp.org>
+
+       execute-tests: Fix compilation error with MSVC.
+       * tests/test-execute-child.c (is_device): With _fstat, use
+       'struct _stat', not 'struct stat'.
+
 2020-12-11  Paul Eggert  <eggert@cs.ucla.edu>
 
        vararrays: just use 2.70
index 16ccff7d60440e66f23ea0595ee6a1b4d316ce76..2310f777679511fe2a3a7a047fac9d07dc69b71d 100644 (file)
 static int
 is_device (int fd)
 {
-  struct stat st;
-  return
 #if defined _WIN32 && ! defined __CYGWIN__
-         _fstat (fd, &st) >= 0
+  struct _stat st;
+  return _fstat (fd, &st) >= 0 && !((st.st_mode & S_IFMT) == S_IFREG);
 #else
-         fstat (fd, &st) >= 0
+  struct stat st;
+  return fstat (fd, &st) >= 0 && !S_ISREG (st.st_mode);
 #endif
-         && !S_ISREG (st.st_mode);
 }
 
 /* Now include the other header files.  */