1 2 3 4 5 6 7 8 9 10 11
#include <sys/stat.h> #include <sys/xattr.h> #include <fcntl.h> #include <string.h> int main(int argc, char **argv) { int fd = open(argv[1], O_RDONLY); return fsetxattr(fd, argv[2], argv[3], strlen(argv[3]) + 1, 0); }