]> git.ipfire.org Git - thirdparty/make.git/commitdiff
* src/output.h: [WINDOWS32] [SV 57888] Use gnulib fcntl if available
authorJens Rehsack <sno@netbsd.org>
Fri, 21 Feb 2020 18:29:49 +0000 (19:29 +0100)
committerPaul Smith <psmith@gnu.org>
Tue, 31 Mar 2020 05:07:43 +0000 (01:07 -0400)
If gnulib fcntl is available (for MinGW32) use it rather than our
homegrown version.

Signed-off-by: Jens Rehsack <sno@netbsd.org>
Copyright-paperwork-exempt: yes

src/output.h
src/w32/compat/posixfcn.c

index a5065058ccdc28be86165315419ce9be8ab58c4f..ece1c706454ed36a6e9c348f2431b048f0a96999 100644 (file)
@@ -67,14 +67,21 @@ void output_dump (struct output *out);
 
 # ifdef WINDOWS32
 /* For emulations in w32/compat/posixfcn.c.  */
-#  define F_GETFD 1
-#  define F_SETLKW 2
+#  ifndef F_GETFD
+#   define F_GETFD 1
+#  endif
+#  ifndef F_SETLKW
+#   define F_SETLKW 2
+#  endif
 /* Implementation note: None of the values of l_type below can be zero
    -- they are compared with a static instance of the struct, so zero
    means unknown/invalid, see w32/compat/posixfcn.c. */
-#  define F_WRLCK 1
-#  define F_UNLCK 2
-
+#  ifndef F_WRLCK
+#   define F_WRLCK 1
+#  endif
+#  ifndef F_UNLCK
+#   define F_UNLCK 2
+#  endif
 struct flock
   {
     short l_type;
@@ -89,7 +96,9 @@ struct flock
 typedef intptr_t sync_handle_t;
 
 /* Public functions emulated/provided in posixfcn.c.  */
+#  if !defined(GNULIB_defined_rpl_fcntl) && !defined(GNULIB_defined_fcntl)
 int fcntl (intptr_t fd, int cmd, ...);
+#  endif
 intptr_t create_mutex (void);
 int same_stream (FILE *f1, FILE *f2);
 
index 975dfb730f06f164ea137afa369c0aa9c0e3df66..00d87e0059b1ce272239b9879ace95b176888432 100644 (file)
@@ -29,6 +29,7 @@ this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifndef NO_OUTPUT_SYNC
 /* Support for OUTPUT_SYNC and related functionality.  */
 
+#if !defined(GNULIB_defined_rpl_fcntl) && !defined(GNULIB_defined_fcntl)
 /* Emulation of fcntl that supports only F_GETFD and F_SETLKW.  */
 int
 fcntl (intptr_t fd, int cmd, ...)
@@ -142,6 +143,7 @@ fcntl (intptr_t fd, int cmd, ...)
         return -1;
     }
 }
+#endif /* GNULIB_defined_fcntl */
 
 static intptr_t mutex_handle = -1;