aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2022-09-13 17:39:02 +0000
committerEd Maste <emaste@FreeBSD.org>2024-05-07 00:03:52 +0000
commit8d0ca017408ed87de0e3f8746421e88a834b9bb0 (patch)
tree930bafbf6cc8040a4bf7a14e7e13708aa7004990
parent6290fc5eeffc2cb145c1715d9b2a1ccf996660b6 (diff)
downloadsrc-8d0ca017408ed87de0e3f8746421e88a834b9bb0.tar.gz
src-8d0ca017408ed87de0e3f8746421e88a834b9bb0.zip
Update capsicum-test to eab7a83b05becf64439b4b256b3d756b353fbbbb
(cherry picked from commit 4ee9db7a1d428a0c067ad4c65591972872eb2ade) PR: 266112
-rw-r--r--contrib/capsicum-test/syscalls.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/contrib/capsicum-test/syscalls.h b/contrib/capsicum-test/syscalls.h
index 592a1677e1f1..3ea8803c2f64 100644
--- a/contrib/capsicum-test/syscalls.h
+++ b/contrib/capsicum-test/syscalls.h
@@ -47,16 +47,29 @@ inline int bogus_mount_() {
/* Mappings for extended attribute functions */
#include <sys/extattr.h>
+#include <errno.h>
+static const char *fbsd_extattr_skip_prefix(const char *p) {
+ if (*p++ == 'u' && *p++ == 's' && *p++ == 'e' && *p++ == 'r' && *p++ == '.')
+ return p;
+ errno = EINVAL;
+ return NULL;
+}
inline ssize_t flistxattr_(int fd, char *list, size_t size) {
return extattr_list_fd(fd, EXTATTR_NAMESPACE_USER, list, size);
}
inline ssize_t fgetxattr_(int fd, const char *name, void *value, size_t size) {
+ if (!(name = fbsd_extattr_skip_prefix(name)))
+ return -1;
return extattr_get_fd(fd, EXTATTR_NAMESPACE_USER, name, value, size);
}
inline int fsetxattr_(int fd, const char *name, const void *value, size_t size, int) {
+ if (!(name = fbsd_extattr_skip_prefix(name)))
+ return -1;
return extattr_set_fd(fd, EXTATTR_NAMESPACE_USER, name, value, size);
}
inline int fremovexattr_(int fd, const char *name) {
+ if (!(name = fbsd_extattr_skip_prefix(name)))
+ return -1;
return extattr_delete_fd(fd, EXTATTR_NAMESPACE_USER, name);
}