]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
compat-cloexec: fix HAVE_DECL checks
authorEnrico Scholz <enrico.scholz@sigma-chemnitz.de>
Wed, 31 Jul 2024 16:08:58 +0000 (18:08 +0200)
committerEnrico Scholz <enrico.scholz@sigma-chemnitz.de>
Wed, 31 Jul 2024 16:18:25 +0000 (18:18 +0200)
AC_CHECK_DECLS() always defines the related HAVE_DECL_xxx symbol (either
as '1' or as '0').

Fix the related #if blocks to check additionally for value beside the
existence of this symbol.  Checking for existence is required for
e.g. Windows builds.

https://github.com/oetiker/rrdtool-1.x/issues/1261

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
src/compat-cloexec.c
src/compat-cloexec.h

index 6931fa7ed98e35f624d23c3d0a4dd85ae8bb6884..cd6c9d05540fd8f86203df3a7cb551d8d42a70e8 100644 (file)
@@ -17,7 +17,7 @@
 
 inline static bool have_decl_o_cloexec(void)
 {
-#ifdef HAVE_DECL_O_CLOEXEC
+#if defined(HAVE_DECL_O_CLOEXEC) && HAVE_DECL_O_CLOEXEC
        return true;
 #else
        return false;
index 0d4d2b6eeb3cede60364e3da9dadf0eb9b04e6cf..13bfffc0611199e3c2bb8e63fa32b4f15ae348ae 100644 (file)
@@ -3,11 +3,11 @@
 
 #include <rrd_config.h>
 
-#ifndef HAVE_DECL_O_CLOEXEC
+#if !defined(HAVE_DECL_O_CLOEXEC) || !HAVE_DECL_O_CLOEXEC
 #  define O_CLOEXEC 0
 #endif
 
-#ifndef HAVE_DECL_SOCK_CLOEXEC
+#if !defined(HAVE_DECL_SOCK_CLOEXEC) || !HAVE_DECL_SOCK_CLOEXEC
 #  define SOCK_CLOEXEC 0
 #endif