diff options
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"); + } +} |