+ return log_error_errno(errno, "chown(%s) failed: %m", path);
+ }
+
+ return label_fix(path, false, false);
+}
+
+static int get_xattrs_from_arg(Item *i) {
+ char *xattr;
+ const char *p;
+ int r;
+
+ assert(i);
+ assert(i->argument);
+
+ p = i->argument;
+
+ while ((r = unquote_first_word(&p, &xattr, false)) > 0) {
+ _cleanup_free_ char *tmp = NULL, *name = NULL,
+ *value = NULL, *value2 = NULL, *_xattr = xattr;
+
+ r = split_pair(xattr, "=", &name, &value);
+ if (r < 0) {
+ log_warning("Illegal xattr found: \"%s\" - ignoring.", xattr);
+ continue;
+ }
+
+ if (strempty(name) || strempty(value)) {
+ log_warning("Malformed xattr found: \"%s\" - ignoring.", xattr);
+ continue;
+ }
+
+ tmp = unquote(value, "\"");
+ if (!tmp)
+ return log_oom();
+
+ value2 = cunescape(tmp);
+ if (!value2)
+ return log_oom();
+
+ if (strv_push_pair(&i->xattrs, name, value2) < 0)
+ return log_oom();
+ name = value2 = NULL;
+ }
+
+ return r;
+}
+
+static int path_set_xattrs(Item *i, const char *path) {
+ char **name, **value;
+
+ assert(i);
+ assert(path);
+
+ STRV_FOREACH_PAIR(name, value, i->xattrs) {
+ int n;
+
+ n = strlen(*value);
+ log_debug("\"%s\": setting xattr \"%s=%s\"", path, *name, *value);
+ if (lsetxattr(path, *name, *value, n, 0) < 0) {
+ log_error("Setting extended attribute %s=%s on %s failed: %m",
+ *name, *value, path);
+ return -errno;