From 2fdfee1519a62e6ab45c5fb78cbbdd97e74a74a0 Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Sun, 2 Feb 2025 09:11:54 -0800 Subject: [PATCH] gh-129539: Include sysexits.h before checking EX_OK Previously the macro would be redefined when the header was included. --- .../Build/2025-02-02-09-11-45.gh-issue-129539.SYXXCg.rst | 1 + Modules/posixmodule.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2025-02-02-09-11-45.gh-issue-129539.SYXXCg.rst diff --git a/Misc/NEWS.d/next/Build/2025-02-02-09-11-45.gh-issue-129539.SYXXCg.rst b/Misc/NEWS.d/next/Build/2025-02-02-09-11-45.gh-issue-129539.SYXXCg.rst new file mode 100644 index 00000000000000..9781dc05b64823 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2025-02-02-09-11-45.gh-issue-129539.SYXXCg.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 6b2cb96629dc6c..40d0f86e6aecdd 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,6 +288,10 @@ corresponding Unix manual entries for more information on calls."); # include #endif +#if !defined(EX_OK) && defined(EXIT_SUCCESS) +# define EX_OK EXIT_SUCCESS +#endif + #ifdef HAVE_SYS_LOADAVG_H # include #endif