From: Enrico Scholz Date: Wed, 31 Jul 2024 16:08:58 +0000 (+0200) Subject: compat-cloexec: fix HAVE_DECL checks X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8a77f3e4123d13b18f712454e038892c4ccf7df2;p=thirdparty%2Frrdtool-1.x.git compat-cloexec: fix HAVE_DECL checks 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 --- diff --git a/src/compat-cloexec.c b/src/compat-cloexec.c index 6931fa7e..cd6c9d05 100644 --- a/src/compat-cloexec.c +++ b/src/compat-cloexec.c @@ -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; diff --git a/src/compat-cloexec.h b/src/compat-cloexec.h index 0d4d2b6e..13bfffc0 100644 --- a/src/compat-cloexec.h +++ b/src/compat-cloexec.h @@ -3,11 +3,11 @@ #include -#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