diff options
author | dzwdz | 2024-08-18 23:06:26 +0200 |
---|---|---|
committer | dzwdz | 2024-08-18 23:06:26 +0200 |
commit | 8b4a2d50de67b746bcc472bd46c55d83eff668fc (patch) | |
tree | 21bcf9814b07bc54e7705f4e9ae93528d627e838 /src/cmd/setxattr.c | |
parent | 446acde84c7f244792bf412996678254ee296356 (diff) |
Diffstat (limited to 'src/cmd/setxattr.c')
-rw-r--r-- | src/cmd/setxattr.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/cmd/setxattr.c b/src/cmd/setxattr.c new file mode 100644 index 0000000..c2e422e --- /dev/null +++ b/src/cmd/setxattr.c @@ -0,0 +1,23 @@ +#include <camellia.h> +#include <camellia/syscalls.h> +#include <err.h> +#include <errno.h> +#include <stdio.h> +#include <string.h> + +int +main(int argc, char **argv) +{ + if (argc != 4) { + fprintf(stderr, "usage: setxattr file key value\n"); + return 1; + } + hid_t h = camellia_open(argv[1], OPEN_WRITE); + if (h < 0) err(1, "open"); + + ssize_t ret = _sys_setxattr(h, argv[2], argv[3], strlen(argv[3]), 0); + if (ret < 0) { + errno = -ret; + err(1, "setxattr"); + } +} |