You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by sh...@apache.org on 2022/05/31 02:06:26 UTC
[bookkeeper] branch master updated: [build] [windows] fix broken master code compile error strerror_s (#3300)
This is an automated email from the ASF dual-hosted git repository.
shoothzj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new 77441e6f26 [build] [windows] fix broken master code compile error strerror_s (#3300)
77441e6f26 is described below
commit 77441e6f2602632b44b7d4a01c6d122cdc2a1ced
Author: ZhangJian He <sh...@gmail.com>
AuthorDate: Tue May 31 10:06:21 2022 +0800
[build] [windows] fix broken master code compile error strerror_s (#3300)
### Motivation
master compile is broken by #2549
### Changes
Add windows `#ifdef _WIN32` directive on `define`. Test on my m1 mac and windows 10.
---
cpu-affinity/src/main/affinity/cpp/affinity_jni.c | 4 ++++
native-io/src/main/native-io-jni/cpp/native_io_jni.c | 6 ++++++
2 files changed, 10 insertions(+)
diff --git a/cpu-affinity/src/main/affinity/cpp/affinity_jni.c b/cpu-affinity/src/main/affinity/cpp/affinity_jni.c
index ebd8b7b9d4..4b724a166f 100644
--- a/cpu-affinity/src/main/affinity/cpp/affinity_jni.c
+++ b/cpu-affinity/src/main/affinity/cpp/affinity_jni.c
@@ -44,6 +44,10 @@ static int set_affinity(int cpuid) { return NOT_IMPLEMENTED; }
static const int IS_AVAILABLE = 0;
+#endif
+
+#ifdef _WIN32
+
#define strerror_r(errno,buf,len) strerror_s(buf,len,errno)
#endif
diff --git a/native-io/src/main/native-io-jni/cpp/native_io_jni.c b/native-io/src/main/native-io-jni/cpp/native_io_jni.c
index 4b90a2d2e2..3e425a86bc 100644
--- a/native-io/src/main/native-io-jni/cpp/native_io_jni.c
+++ b/native-io/src/main/native-io-jni/cpp/native_io_jni.c
@@ -28,6 +28,12 @@
#include <org_apache_bookkeeper_common_util_nativeio_NativeIOJni.h>
+#ifdef _WIN32
+
+#define strerror_r(errno,buf,len) strerror_s(buf,len,errno)
+
+#endif
+
static void throwExceptionWithErrno(JNIEnv* env, const char* message) {
char err_msg[1024];
strerror_r(errno, err_msg, sizeof(err_msg));