From: Bruno Haible Date: Sat, 12 Dec 2020 02:55:48 +0000 (+0100) Subject: execute-tests: Fix compilation error with MSVC. X-Git-Tag: v1.0~3379 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=46c7e327c76f115bbdc6eee75fffa382559aa9d8;p=gnulib.git execute-tests: Fix compilation error with MSVC. * tests/test-execute-child.c (is_device): With _fstat, use 'struct _stat', not 'struct stat'. --- diff --git a/ChangeLog b/ChangeLog index 78aa40ab3f..764f5546f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2020-12-11 Bruno Haible + + 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 vararrays: just use 2.70 diff --git a/tests/test-execute-child.c b/tests/test-execute-child.c index 16ccff7d60..2310f77767 100644 --- a/tests/test-execute-child.c +++ b/tests/test-execute-child.c @@ -29,14 +29,13 @@ 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. */