pkgsrc/archivers/archangel/patches/patch-ad
2006-10-01 21:00:20 +00:00

77 lines
2.3 KiB
Text

$NetBSD: patch-ad,v 1.2 2006/10/01 21:00:20 rillig Exp $
--- aa.c.orig 2005-08-01 00:20:23.000000000 +0200
+++ aa.c 2006-08-30 17:56:16.285256480 +0200
@@ -48,6 +48,9 @@
#include <sys/endian.h>
#endif
+#ifdef HAVE_SYS_XATTR_H
+#include <sys/xattr.h>
+#endif
#include <ctype.h>
@@ -534,7 +537,7 @@ readfile(aa_t *aa, aaent_t *aep, char *n
#ifdef HAVE_SETXATTR
/* set the external attributes */
static int
-ext_attr_set(aa_t *aa, aaent_t *aep, char *name);
+ext_attr_set(aa_t *aa, aaent_t *aep, char *name)
{
char *ap;
char *eq;
@@ -549,7 +552,11 @@ ext_attr_set(aa_t *aa, aaent_t *aep, cha
warn("WARNING: malformed attribute (%s) for \"%s\"", ap, name);
} else {
*eq = 0x0;
+#ifdef __APPLE__
+ if (setxattr(name, ap, eq + 1, (int)(nl - eq) - 1, 0, XATTR_CREATE) < 0) {
+#else
if (setxattr(name, ap, eq + 1, (int)(nl - eq) - 1, XATTR_CREATE) < 0) {
+#endif
warn("WARNING: can't setxattr (%s) for \"%s\"", ap, name);
}
*eq = '=';
@@ -605,7 +612,11 @@ extractfile(aa_t *aa, aaent_t *aep, char
warn("extractfile: can't open \"%s\" mode %x", name, mode);
return 0;
}
+#if defined(__sun)
+ if (utimes(name, tv) < 0) {
+#else
if (futimes(fd, tv) < 0) {
+#endif
warn("extractfile: can't set access/modification time for \"%s\"", name);
}
if (aep->sub.xattrlen > 0) {
@@ -927,9 +938,17 @@ ext_attr_get(aa_t *aa, aaent_t *aep, cha
int cc;
int vc;
+#ifdef __APPLE__
+ if ((cc = listxattr(path, keys, sizeof(keys), 0)) > 0) {
+#else
if ((cc = listxattr(path, keys, sizeof(keys))) > 0) {
+#endif
for (ac = 0, key = keys ; (int)(key - keys) < cc ; key += strlen(key)) {
+#ifdef __APPLE__
+ if ((vc = getxattr(path, key, val, sizeof(val), 0, 0)) < 0) {
+#else
if ((vc = getxattr(path, key, val, sizeof(val))) < 0) {
+#endif
warnx("file \"%s\" attribute \"%s\" is too long, skipping...", path, key);
} else {
ac += snprintf(&attrs[ac], sizeof(attrs) - ac, "%s=%s\n", key, val);
@@ -982,7 +1001,11 @@ addent(aa_t *aa, char *name, int namelen
#endif
a.sub.size = sp->st_size;
a.sub.blocks = sp->st_blocks;
+#if defined(__sun)
+ a.sub.flags = 0;
+#else
a.sub.flags = sp->st_flags;
+#endif
a.sub.offset = from;
a.sub.part = from / aa->maxfsize;
a.sub.lastpart = (sp->st_size - from) < aa->maxfsize;