You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-commits@axis.apache.org by ro...@apache.org on 2026/01/13 17:18:16 UTC

(axis-axis2-c-core) 01/06: AXIS2C-1567: Fix F_OK/R_OK undefined on macOS builds

This is an automated email from the ASF dual-hosted git repository.

robertlazarski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-c-core.git

commit 6d3a1e9ab6b422c553ef2a6ae8a57322325b5cbb
Author: Robert Lazarski <ro...@gmail.com>
AuthorDate: Tue Jan 13 04:12:41 2026 -1000

    AXIS2C-1567: Fix F_OK/R_OK undefined on macOS builds
    
    The unistd.h include was incorrectly excluded on Apple platforms with
    #ifndef __APPLE__, but the F_OK, R_OK, W_OK, X_OK constants from that
    header were still being used, causing compilation failures on macOS.
    
    Fix:
    - Remove the incorrect #ifndef __APPLE__ exclusion
    - Add fallback #ifndef definitions for all access() mode constants
    - Use standard POSIX values (F_OK=0, X_OK=1, W_OK=2, R_OK=4)
    
    The fallback approach is defensive - if unistd.h provides the constants,
    they're used; otherwise the standard POSIX values are defined.
    
    Co-Authored-By: Claude Opus 4.5 <no...@anthropic.com>
---
 util/include/platforms/unix/axutil_unix.h | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/util/include/platforms/unix/axutil_unix.h b/util/include/platforms/unix/axutil_unix.h
index a5bf13e68..42fe2f6ee 100644
--- a/util/include/platforms/unix/axutil_unix.h
+++ b/util/include/platforms/unix/axutil_unix.h
@@ -147,12 +147,28 @@ static inline void axis2_android_ftime(struct axis2_android_timeb *tb) {
 #include "axutil_date_time_util_unix.h"
 
     /* for file access handling */
-#ifdef HAVE_UNISTD_H 
-#ifndef __APPLE__
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif /* ifndef __APPLE__ */
 #endif /* HAVE_UNISTD_H */
 
+    /* AXIS2C-1567 FIX: Fallback definitions for access() mode constants
+     * These POSIX constants are typically defined in <unistd.h>, but some
+     * platforms (notably older macOS builds) may not have them available.
+     * The values are standardized by POSIX and are the same across platforms.
+     */
+#ifndef F_OK
+#define F_OK 0  /* Test for existence */
+#endif
+#ifndef R_OK
+#define R_OK 4  /* Test for read permission */
+#endif
+#ifndef W_OK
+#define W_OK 2  /* Test for write permission */
+#endif
+#ifndef X_OK
+#define X_OK 1  /* Test for execute permission */
+#endif
+
     /* network handling */
 #include <sys/socket.h>
 #include <arpa/inet.h>