- {
- const char *attr = xatrs;
- static ssize_t asz = 1024;
- static char *val = NULL;
-
- if (!val)
- val = xmalloc (asz);
-
- while (xret > 0)
- {
- size_t len = strlen (attr);
- ssize_t aret = 0;
-
- /* Archive all xattrs during creation, decide at extraction time
- * which ones are of interest/use for the target filesystem. */
- while (((fd == 0)
- ? ((aret = lgetxattrat (parentfd, file_name, attr,
- val, asz)) == -1)
- : ((aret = fgetxattr (fd, attr, val, asz)) == -1))
- && (errno == ERANGE))
- {
- asz <<= 1;
- val = xrealloc (val, asz);
- }
-
- if (aret != -1)
- xheader_xattr_add (st, attr, val, aret);
- else if (errno != ENOATTR)
- call_arg_warn ((fd == 0) ? "lgetxattrat"
- : "fgetxattr", file_name);
-
- attr += len + 1;
- xret -= len + 1;
- }
- }
+ {
+ const char *attr = xatrs;
+ static size_t asz = 1024;
+ static char *val = NULL;
+
+ if (!val)
+ val = x2nrealloc (val, &asz, 1);
+
+ while (xret > 0)
+ {
+ size_t len = strlen (attr);
+ ssize_t aret = 0;
+
+ /* Archive all xattrs during creation, decide at extraction time
+ * which ones are of interest/use for the target filesystem. */
+ while (((fd == 0)
+ ? ((aret = lgetxattrat (parentfd, file_name, attr,
+ val, asz)) == -1)
+ : ((aret = fgetxattr (fd, attr, val, asz)) == -1))
+ && (errno == ERANGE))
+ {
+ val = x2nrealloc (val, &asz, 1);
+ }
+
+ if (aret != -1)
+ xheader_xattr_add (st, attr, val, aret);
+ else if (errno != ENOATTR)
+ call_arg_warn ((fd == 0) ? "lgetxattrat"
+ : "fgetxattr", file_name);
+
+ attr += len + 1;
+ xret -= len + 1;
+ }
+ }