1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
$NetBSD: patch-ad,v 1.3 2012/01/28 01:52:49 sbd Exp $
--- aa.c.orig 2005-07-31 22:20:23.000000000 +0000
+++ aa.c
@@ -48,6 +48,9 @@
#include <sys/endian.h>
#endif
+#ifdef HAVE_SYS_XATTR_H
+#include <sys/xattr.h>
+#endif
#include <ctype.h>
@@ -221,7 +224,10 @@ asystem(aa_t *aa, const char *file, int
(void) close(fdv[0]);
(void) write(fdv[1], aa->phrase, strlen(aa->phrase));
(void) write(fdv[1], "\n", 1);
- (void) wait(&status);
+#if !defined(__GLIBC__) || !defined(__USE_BSD)
+#define __WAIT_STATUS int *
+#endif
+ (void) wait((__WAIT_STATUS)&status);
(void) close(fdv[1]);
break;
}
@@ -534,7 +540,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 +555,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 +615,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 +941,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 +1004,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) || defined(__linux)
+ 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;
|