]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
fcntl-h: Fix configure test on MSVC.
authorBruno Haible <bruno@clisp.org>
Tue, 3 Jun 2025 21:28:11 +0000 (23:28 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 3 Jun 2025 21:34:07 +0000 (23:34 +0200)
* m4/fcntl-o.m4 (gl_FCNTL_O_FLAGS): Reshuffle the exit code assignments
again, so that a compilation failure produces the "no" result both on
mingw and on MSVC. Fix typo in the test program.

ChangeLog
m4/fcntl-o.m4

index abd0ee05b04f4370e191e6a95ac7f57163eee3be..1aac32291c4edce895fba2849d10fee1709409e2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-06-03  Bruno Haible  <bruno@clisp.org>
+
+       fcntl-h: Fix configure test on MSVC.
+       * m4/fcntl-o.m4 (gl_FCNTL_O_FLAGS): Reshuffle the exit code assignments
+       again, so that a compilation failure produces the "no" result both on
+       mingw and on MSVC. Fix typo in the test program.
+
 2025-06-03  Collin Funk  <collin.funk1@gmail.com>
 
        setlocale: Update a comment.
index 38321e59646b707f6820aa9a32beeaceb3dbe9b6..8020c481f7791d96cf82d56cc0e9f76c2c30725f 100644 (file)
@@ -1,5 +1,5 @@
 # fcntl-o.m4
-# serial 11
+# serial 12
 dnl Copyright (C) 2006, 2009-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -32,7 +32,7 @@ AC_DEFUN([gl_FCNTL_O_FLAGS],
            #else /* on Windows with MSVC */
            # include <io.h>
            # include <stdlib.h>
-           # defined sleep(n) _sleep ((n) * 1000)
+           # define sleep(n) _sleep ((n) * 1000)
            #endif
            #include <errno.h>
            #include <fcntl.h>
@@ -68,7 +68,7 @@ AC_DEFUN([gl_FCNTL_O_FLAGS],
                   if (fd >= 0)
                     {
                       close (fd);
-                      result |= 2;
+                      result |= 3;
                     }
                 }
               if (unlink (sym) != 0 || symlink (".", sym) != 0)
@@ -79,7 +79,7 @@ AC_DEFUN([gl_FCNTL_O_FLAGS],
                   if (fd >= 0)
                     {
                       close (fd);
-                      result |= 2;
+                      result |= 3;
                     }
                 }
               unlink (sym);
@@ -128,16 +128,20 @@ AC_DEFUN([gl_FCNTL_O_FLAGS],
             return result;]])],
        [gl_cv_header_working_fcntl_h=yes],
        [AS_CASE([$?],
-          dnl We cannot catch exit code 1 here, because exit code 1 can occur
-          dnl through a compilation error (e.g. when O_NOCTTY, O_NONBLOCK, O_SYNC
-          dnl are not defined) or when result = 1.
-          [ 2], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW)"],
+          dnl We cannot catch exit code 1 or 2 here, because
+          dnl - exit code 1 can occur through a compilation error on mingw (e.g.
+          dnl   when O_NOCTTY, O_NONBLOCK, O_SYNC are not defined) or when
+          dnl   result = 1, whereas
+          dnl - exit code 2 can occur through a compilation error on MSVC (e.g.
+          dnl   again when O_NOCTTY, O_NONBLOCK, O_SYNC are not defined) or when
+          dnl   result = 2.
+          [ 3], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW)"],
           [ 4], [gl_cv_header_working_fcntl_h="no (bad O_DIRECTORY)"],
-          [ 6], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW, O_DIRECTORY)"],
+          [ 7], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW, O_DIRECTORY)"],
           [64], [gl_cv_header_working_fcntl_h="no (bad O_NOATIME)"],
-          [66], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW, O_NOATIME)"],
+          [67], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW, O_NOATIME)"],
           [68], [gl_cv_header_working_fcntl_h="no (bad O_DIRECTORY, O_NOATIME)"],
-          [70], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW, O_DIRECTORY, O_NOATIME)"],
+          [71], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW, O_DIRECTORY, O_NOATIME)"],
           [gl_cv_header_working_fcntl_h="no"])],
        [AS_CASE([$host_os,$gl_cross_guess_normal],
           # The O_DIRECTORY test is known to fail on Mac OS X 10.4.11 (2007)