noinst_SCRIPTS = run-all
noinst_PROGRAMS = simple1 permissions1 permissions2 owner1 owner2 owner3 \
- directory1 missing-directory1 error1 error2 error4
+ directory1 missing-directory1 error1 error2 error4 xattrs1
simple1_SOURCES = simple1.cc common.h common.cc
error2_SOURCES = error2.cc common.h common.cc
error4_SOURCES = error4.cc common.h common.cc
+xattrs1_SOURCES = xattrs1.cc xattrs_utils.cc xattrs_utils.h common.h common.cc
+
EXTRA_DIST = $(noinst_SCRIPTS)
--- /dev/null
+#include <iostream>
+
+#include "common.h"
+#include "xattrs_utils.h"
+
+using namespace std;
+
+int
+main()
+{
+ setup();
+
+ run_command("touch file1");
+ run_command("setfacl -b file1");
+ run_command("setfacl -m u:nobody:rw file1");
+ xattr_create("user.aaa", "aaa-value", "/testsuite/file1");
+ xattr_create("user.bbb", "bbb-value", "/testsuite/file1");
+
+ first_snapshot();
+
+ run_command("setfacl -b file1");
+ xattr_remove("user.aaa","/testsuite/file1");
+ xattr_replace("user.bbb", "bbb-new-value", "/testsuite/file1");
+
+ second_snapshot();
+
+ check_undo_statistics(0, 1, 0);
+
+ undo();
+
+ check_undo_errors(0, 0, 0);
+
+ check_first();
+
+ exit(EXIT_SUCCESS);
+}
--- /dev/null
+#include <string.h>
+#include <sys/xattr.h>
+
+#include <snapper/XAttributes.h>
+#include "xattrs_utils.h"
+#include "common.h"
+
+void xattr_create(const char *name, const char *value, const char *path)
+{
+ check_zero(setxattr(path, name, (void *) value, strlen(value), XATTR_CREATE));
+}
+
+void xattr_remove(const char *name, const char *path)
+{
+ check_zero(removexattr(path, name));
+}
+
+void xattr_replace(const char *name, const char *value, const char *path)
+{
+ check_zero(setxattr(path, name, (void *) value, strlen(value), XATTR_REPLACE));
+}
\ No newline at end of file
--- /dev/null
+
+
+void xattr_create(const char *, const char *, const char *);
+
+void xattr_remove(const char *, const char *);
+
+void xattr_replace(const char *, const char *, const char *);
\ No newline at end of file