aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/native/unix_jni.h
diff options
context:
space:
mode:
authorGravatar ajmichael <ajmichael@google.com>2018-02-09 10:19:29 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-02-09 10:20:51 -0800
commitad32f62952e2b6f8293a26ea5fd677e61975c9ff (patch)
treef5036251b75b6822fba34fce5ac2fa6425e5383e /src/main/native/unix_jni.h
parent8cc1706ac8e9751e347720054ede3a3d88385c88 (diff)
Make getxattr not throw an exception when attribute does not exist on Mac.
This matches the current behavior on Linux. When an extended attribute is not present on a file, getxattr on Linux returns ENODATA whereas getxattr on Mac returns ENOATTR. Previously, we were special casing ENODATA to not throw an exception but not ENOATTR. Now we treat them the same. RELNOTES: None PiperOrigin-RevId: 185157964
Diffstat (limited to 'src/main/native/unix_jni.h')
-rw-r--r--src/main/native/unix_jni.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/native/unix_jni.h b/src/main/native/unix_jni.h
index f4a1600161..19d5b3f1f8 100644
--- a/src/main/native/unix_jni.h
+++ b/src/main/native/unix_jni.h
@@ -83,13 +83,17 @@ int StatSeconds(const portable_stat_struct &statbuf, StatTimes t);
// Returns nanoseconds from a stat buffer.
int StatNanoSeconds(const portable_stat_struct &statbuf, StatTimes t);
-// Runs getxattr(2), if available. If not, sets errno to ENOSYS.
+// Runs getxattr(2). If the attribute is not found, returns -1 and sets
+// attr_not_found to true. For all other errors, returns -1, sets attr_not_found
+// to false and leaves errno set to the error code returned by the system.
ssize_t portable_getxattr(const char *path, const char *name, void *value,
- size_t size);
+ size_t size, bool *attr_not_found);
-// Run lgetxattr(2), if available. If not, sets errno to ENOSYS.
+// Runs lgetxattr(2). If the attribute is not found, returns -1 and sets
+// attr_not_found to true. For all other errors, returns -1, sets attr_not_found
+// to false and leaves errno set to the error code returned by the system.
ssize_t portable_lgetxattr(const char *path, const char *name, void *value,
- size_t size);
+ size_t size, bool *attr_not_found);
// Run sysctlbyname(3), only available on darwin
int portable_sysctlbyname(const char *name_chars, long *mibp, size_t *sizep);