From 4d1df0dba8ceeddb3b582e19dec2aecb07ab21e3 Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Fri, 31 Jan 2025 19:01:44 -0800 Subject: [PATCH] gh-129539: Include sysexits.h before checking EX_OK Previously the macro would be redefined when the header was included. --- .../2025-01-31-19-01-24.gh-issue-129539.6ndioH.rst | 1 + Modules/posixmodule.c | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2025-01-31-19-01-24.gh-issue-129539.6ndioH.rst diff --git a/Misc/NEWS.d/next/Build/2025-01-31-19-01-24.gh-issue-129539.6ndioH.rst b/Misc/NEWS.d/next/Build/2025-01-31-19-01-24.gh-issue-129539.6ndioH.rst new file mode 100644 index 00000000000000..9781dc05b64823 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2025-01-31-19-01-24.gh-issue-129539.6ndioH.rst @@ -0,0 +1 @@ +Don't redefine ``EX_OK`` when the system has the ``sysexits.h`` header. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index b3b5572e1cfa30..658aa402790f71 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -52,10 +52,6 @@ # include "winreparse.h" #endif -#if !defined(EX_OK) && defined(EXIT_SUCCESS) -# define EX_OK EXIT_SUCCESS -#endif - #ifdef __APPLE__ /* Needed for the implementation of os.statvfs */ # include @@ -292,7 +288,11 @@ corresponding Unix manual entries for more information on calls."); #endif #ifdef HAVE_SYSEXITS_H -# include +# include // EX_OK +#endif + +#if !defined(EX_OK) && defined(EXIT_SUCCESS) +# define EX_OK EXIT_SUCCESS #endif #ifdef HAVE_SYS_LOADAVG_H