From 46c7e327c76f115bbdc6eee75fffa382559aa9d8 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 12 Dec 2020 03:55:48 +0100 Subject: [PATCH] execute-tests: Fix compilation error with MSVC. * tests/test-execute-child.c (is_device): With _fstat, use 'struct _stat', not 'struct stat'. --- ChangeLog | 6 ++++++ tests/test-execute-child.c | 9 ++++----- 2 files changed, 10 insertions(+), 5 deletions(-) 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. */ -- 2.39.5