This is an automated email from the ASF dual-hosted git repository.
paleolimbot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-nanoarrow.git
The following commit(s) were added to refs/heads/main by this push:
new 7b6d8470 fix: Fix ENODATA undefined on FreeBSD and OpenBSD (#906)
7b6d8470 is described below
commit 7b6d84700cfe849d0b13a621a271840b113c9b75
Author: Michael Osipov <[email protected]>
AuthorDate: Wed Jul 22 04:26:42 2026 +0200
fix: Fix ENODATA undefined on FreeBSD and OpenBSD (#906)
ENODATA is an XSI/SVID extension, not part of the POSIX base
specification, so <errno.h> is not required to define it. FreeBSD and
OpenBSD do not define it, which currently breaks the build of
nanoarrow_ipc on those platforms. (NetBSD already defines ENODATA itself
and is unaffected.)
The existing fallback only kicked in for old Windows/MinGW toolchains (R
3.6). Widen the guard to apply on any platform that does not define
ENODATA, so FreeBSD, OpenBSD, and other such systems also get the
fallback definition.
The value 120 matches the existing Windows/MinGW fallback and does not
collide with any errno value defined by FreeBSD (ELAST == 97 as of
FreeBSD 16-CURRENT) or OpenBSD (ELAST == 95).
---
src/nanoarrow/ipc/decoder.c | 5 +++--
src/nanoarrow/ipc/reader.c | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/nanoarrow/ipc/decoder.c b/src/nanoarrow/ipc/decoder.c
index 7b24bc3a..42ba2457 100644
--- a/src/nanoarrow/ipc/decoder.c
+++ b/src/nanoarrow/ipc/decoder.c
@@ -25,8 +25,9 @@
#include "nanoarrow/nanoarrow.h"
#include "nanoarrow/nanoarrow_ipc.h"
-// R 3.6 / Windows builds on a very old toolchain that does not define ENODATA
-#if defined(_WIN32) && !defined(_MSC_VER) && !defined(ENODATA)
+// ENODATA is an XSI extension and is not defined by all libcs (e.g., older
+// Windows/MinGW toolchains used by R 3.6, FreeBSD, and OpenBSD).
+#if !defined(ENODATA)
#define ENODATA 120
#endif
diff --git a/src/nanoarrow/ipc/reader.c b/src/nanoarrow/ipc/reader.c
index f69d441f..0b99b828 100644
--- a/src/nanoarrow/ipc/reader.c
+++ b/src/nanoarrow/ipc/reader.c
@@ -23,8 +23,9 @@
#include "nanoarrow/nanoarrow.h"
#include "nanoarrow/nanoarrow_ipc.h"
-// R 3.6 / Windows builds on a very old toolchain that does not define ENODATA
-#if defined(_WIN32) && !defined(_MSC_VER) && !defined(ENODATA)
+// ENODATA is an XSI extension and is not defined by all libcs (e.g., older
+// Windows/MinGW toolchains used by R 3.6, FreeBSD, and OpenBSD).
+#if !defined(ENODATA)
#define ENODATA 120
#endif