Update FreeBSD JNI to support new attr_not_found parameter.
Fixes #4674.
Tested: https://ci.bazel.build/blue/organizations/jenkins/CR%2Fbazel-tests/detail/bazel-tests/903/pipeline/ (FreeBSD tests pass, failures are unrelated)
Change-Id: Ifc9c5be0cb4d7c877c64fc21632ae8a8c9582d33
PiperOrigin-RevId: 186651937
diff --git a/src/main/native/unix_jni_freebsd.cc b/src/main/native/unix_jni_freebsd.cc
index 5be1d4d..3b60e29 100644
--- a/src/main/native/unix_jni_freebsd.cc
+++ b/src/main/native/unix_jni_freebsd.cc
@@ -71,13 +71,19 @@
}
ssize_t portable_getxattr(const char *path, const char *name, void *value,
- size_t size) {
- return extattr_get_file(path, EXTATTR_NAMESPACE_SYSTEM, name, value, size);
+ size_t size, bool *attr_not_found) {
+ ssize_t result =
+ extattr_get_file(path, EXTATTR_NAMESPACE_SYSTEM, name, value, size);
+ *attr_not_found = (errno == ENOATTR);
+ return result;
}
ssize_t portable_lgetxattr(const char *path, const char *name, void *value,
- size_t size) {
- return extattr_get_link(path, EXTATTR_NAMESPACE_SYSTEM, name, value, size);
+ size_t size, bool *attr_not_found) {
+ ssize_t result =
+ extattr_get_link(path, EXTATTR_NAMESPACE_SYSTEM, name, value, size);
+ *attr_not_found = (errno == ENOATTR);
+ return result;
}
int portable_sysctlbyname(const char *name_chars, long *mibp, size_t *sizep) {