annotate tests/test-sameacls.c @ 40196:e63f5d3edab5

relocatable-prog: Update documentation. * doc/relocatable-maint.texi (Supporting Relocation): Update to match the recent changes.
author Bruno Haible <bruno@clisp.org>
date Sun, 24 Feb 2019 01:49:15 +0100
parents b06060465f09
children 5d9b82ca550a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Test whether two files have the same ACLs.
40057
b06060465f09 maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents: 19484
diff changeset
2 Copyright (C) 2008-2019 Free Software Foundation, Inc.
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 This program is free software: you can redistribute it and/or modify
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 the Free Software Foundation; either version 3 of the License, or
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 (at your option) any later version.
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 GNU General Public License for more details.
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
19190
9759915b2aca all: prefer https: URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 18626
diff changeset
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 /* Written by Bruno Haible <bruno@clisp.org>, 2008. */
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 #include <config.h>
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 #include <errno.h>
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 #include <stdio.h>
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 #include <stdlib.h>
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 #include <string.h>
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 #include <sys/stat.h>
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26
14898
d1e05397f517 acl tests: Fix compilation error on HP-UX 11.
Bruno Haible <bruno@clisp.org>
parents: 14871
diff changeset
27 #if HAVE_ACL_GET_FILE || HAVE_FACL || HAVE_GETACL || HAVE_ACLX_GET || HAVE_STATACL || HAVE_ACLSORT
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 # include <sys/types.h>
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 # include <sys/acl.h>
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 #endif
14905
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
31 #if HAVE_ACLV_H
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
32 # include <sys/types.h>
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
33 # include <aclv.h>
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
34 #endif
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 #include "read-file.h"
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 #include "xalloc.h"
12496
a48d3d749ca5 Refactor common macros used in tests.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
38 #include "macros.h"
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 int
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 main (int argc, char *argv[])
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 {
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 const char *file1;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 const char *file2;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 ASSERT (argc == 3);
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 file1 = argv[1];
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 file2 = argv[2];
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 /* Compare the contents of the two files. */
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 {
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 size_t size1;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 char *contents1;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55 size_t size2;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
56 char *contents2;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
57
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
58 contents1 = read_file (file1, &size1);
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
59 if (contents1 == NULL)
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
60 {
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
61 fprintf (stderr, "error reading file %s: errno = %d\n", file1, errno);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
62 fflush (stderr);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
63 abort ();
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
64 }
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
65 contents2 = read_file (file2, &size2);
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
66 if (contents2 == NULL)
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
67 {
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
68 fprintf (stderr, "error reading file %s: errno = %d\n", file2, errno);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
69 fflush (stderr);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
70 abort ();
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
71 }
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
72
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
73 if (size2 != size1)
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
74 {
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
75 fprintf (stderr, "files %s and %s have different sizes\n",
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
76 file1, file2);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
77 fflush (stderr);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
78 abort ();
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
79 }
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
80 if (memcmp (contents1, contents2, size1) != 0)
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
81 {
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
82 fprintf (stderr, "files %s and %s have different contents\n",
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
83 file1, file2);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
84 fflush (stderr);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
85 abort ();
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
86 }
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
87 }
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
88
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
89 /* Compare the access permissions of the two files, including ACLs. */
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
90 {
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
91 struct stat statbuf1;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
92 struct stat statbuf2;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
93
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
94 if (stat (file1, &statbuf1) < 0)
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
95 {
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
96 fprintf (stderr, "error accessing file %s: errno = %d\n", file1, errno);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
97 fflush (stderr);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
98 abort ();
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
99 }
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
100 if (stat (file2, &statbuf2) < 0)
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
101 {
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
102 fprintf (stderr, "error accessing file %s: errno = %d\n", file2, errno);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
103 fflush (stderr);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
104 abort ();
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
105 }
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
106 if (statbuf1.st_mode != statbuf2.st_mode)
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
107 {
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
108 fprintf (stderr, "files %s and %s have different access modes: %03o and %03o\n",
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
109 file1, file2,
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
110 (unsigned int) statbuf1.st_mode, (unsigned int) statbuf2.st_mode);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
111 return 1;
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
112 }
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
113 }
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
114 {
16935
498a2211d839 Write "Mac OS X" instead of "MacOS X".
Bruno Haible <bruno@clisp.org>
parents: 16381
diff changeset
115 #if HAVE_ACL_GET_FILE /* Linux, FreeBSD, Mac OS X, IRIX, Tru64 */
10141
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
116 static const int types[] =
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
117 {
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
118 ACL_TYPE_ACCESS
16935
498a2211d839 Write "Mac OS X" instead of "MacOS X".
Bruno Haible <bruno@clisp.org>
parents: 16381
diff changeset
119 # if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
120 , ACL_TYPE_EXTENDED
10141
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
121 # endif
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
122 };
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
123 int t;
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
124
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
125 for (t = 0; t < sizeof (types) / sizeof (types[0]); t++)
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
126 {
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
127 int type = types[t];
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
128 acl_t acl1;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
129 char *text1;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
130 int errno1;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
131 acl_t acl2;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
132 char *text2;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
133 int errno2;
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
134
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
135 acl1 = acl_get_file (file1, type);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
136 if (acl1 == (acl_t)NULL)
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
137 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
138 text1 = NULL;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
139 errno1 = errno;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
140 }
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
141 else
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
142 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
143 text1 = acl_to_text (acl1, NULL);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
144 if (text1 == NULL)
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
145 errno1 = errno;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
146 else
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
147 errno1 = 0;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
148 }
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
149 acl2 = acl_get_file (file2, type);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
150 if (acl2 == (acl_t)NULL)
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
151 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
152 text2 = NULL;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
153 errno2 = errno;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
154 }
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
155 else
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
156 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
157 text2 = acl_to_text (acl2, NULL);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
158 if (text2 == NULL)
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
159 errno2 = errno;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
160 else
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
161 errno2 = 0;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
162 }
10141
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
163
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
164 if (acl1 != (acl_t)NULL)
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
165 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
166 if (acl2 != (acl_t)NULL)
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
167 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
168 if (text1 != NULL)
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
169 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
170 if (text2 != NULL)
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
171 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
172 if (strcmp (text1, text2) != 0)
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
173 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
174 fprintf (stderr, "files %s and %s have different ACLs:\n%s\n%s\n",
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
175 file1, file2, text1, text2);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
176 return 1;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
177 }
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
178 }
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
179 else
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
180 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
181 fprintf (stderr, "file %s has a valid ACL, but file %s has an invalid ACL\n",
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
182 file1, file2);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
183 return 1;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
184 }
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
185 }
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
186 else
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
187 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
188 if (text2 != NULL)
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
189 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
190 fprintf (stderr, "file %s has an invalid ACL, but file %s has a valid ACL\n",
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
191 file1, file2);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
192 return 1;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
193 }
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
194 else
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
195 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
196 if (errno1 != errno2)
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
197 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
198 fprintf (stderr, "files %s and %s have differently invalid ACLs, errno = %d vs. %d\n",
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
199 file1, file2, errno1, errno2);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
200 return 1;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
201 }
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
202 }
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
203 }
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
204 }
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
205 else
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
206 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
207 fprintf (stderr, "file %s has an ACL, but file %s has no ACL\n",
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
208 file1, file2);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
209 return 1;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
210 }
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
211 }
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
212 else
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
213 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
214 if (acl2 != (acl_t)NULL)
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
215 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
216 fprintf (stderr, "file %s has no ACL, but file %s has an ACL\n",
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
217 file1, file2);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
218 return 1;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
219 }
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
220 }
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
221 }
13757
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
222 #elif HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
223 int count1;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
224 int count2;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
225
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
226 count1 = acl (file1, GETACLCNT, 0, NULL);
15578
79ba5f83de2a acl: Fix a test failure on newer Solaris 10 with ZFS.
Bruno Haible <bruno@clisp.org>
parents: 15576
diff changeset
227 if (count1 < 0 && errno == ENOSYS) /* Can happen on Solaris 10 with ZFS */
79ba5f83de2a acl: Fix a test failure on newer Solaris 10 with ZFS.
Bruno Haible <bruno@clisp.org>
parents: 15576
diff changeset
228 count1 = 0;
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
229 count2 = acl (file2, GETACLCNT, 0, NULL);
15578
79ba5f83de2a acl: Fix a test failure on newer Solaris 10 with ZFS.
Bruno Haible <bruno@clisp.org>
parents: 15576
diff changeset
230 if (count2 < 0 && errno == ENOSYS) /* Can happen on Solaris 10 with ZFS */
79ba5f83de2a acl: Fix a test failure on newer Solaris 10 with ZFS.
Bruno Haible <bruno@clisp.org>
parents: 15576
diff changeset
231 count2 = 0;
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
232
10141
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
233 if (count1 < 0)
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
234 {
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
235 fprintf (stderr, "error accessing the ACLs of file %s\n", file1);
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
236 fflush (stderr);
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
237 abort ();
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
238 }
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
239 if (count2 < 0)
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
240 {
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
241 fprintf (stderr, "error accessing the ACLs of file %s\n", file2);
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
242 fflush (stderr);
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
243 abort ();
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
244 }
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
245 if (count1 != count2)
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
246 {
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
247 fprintf (stderr, "files %s and %s have different number of ACLs: %d and %d\n",
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
248 file1, file2, count1, count2);
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
249 return 1;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
250 }
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
251 else
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
252 {
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
253 aclent_t *entries1 = XNMALLOC (count1, aclent_t);
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
254 aclent_t *entries2 = XNMALLOC (count2, aclent_t);
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
255 int i;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
256
15578
79ba5f83de2a acl: Fix a test failure on newer Solaris 10 with ZFS.
Bruno Haible <bruno@clisp.org>
parents: 15576
diff changeset
257 if (count1 > 0 && acl (file1, GETACL, count1, entries1) < count1)
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
258 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
259 fprintf (stderr, "error retrieving the ACLs of file %s\n", file1);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
260 fflush (stderr);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
261 abort ();
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
262 }
15578
79ba5f83de2a acl: Fix a test failure on newer Solaris 10 with ZFS.
Bruno Haible <bruno@clisp.org>
parents: 15576
diff changeset
263 if (count2 > 0 && acl (file2, GETACL, count2, entries2) < count1)
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
264 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
265 fprintf (stderr, "error retrieving the ACLs of file %s\n", file2);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
266 fflush (stderr);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
267 abort ();
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
268 }
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
269 for (i = 0; i < count1; i++)
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
270 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
271 if (entries1[i].a_type != entries2[i].a_type)
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
272 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
273 fprintf (stderr, "files %s and %s: different ACL entry #%d: different types %d and %d\n",
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
274 file1, file2, i, entries1[i].a_type, entries2[i].a_type);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
275 return 1;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
276 }
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
277 if (entries1[i].a_id != entries2[i].a_id)
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
278 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
279 fprintf (stderr, "files %s and %s: different ACL entry #%d: different ids %d and %d\n",
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
280 file1, file2, i, (int)entries1[i].a_id, (int)entries2[i].a_id);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
281 return 1;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
282 }
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
283 if (entries1[i].a_perm != entries2[i].a_perm)
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
284 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
285 fprintf (stderr, "files %s and %s: different ACL entry #%d: different permissions %03o and %03o\n",
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
286 file1, file2, i, (unsigned int) entries1[i].a_perm, (unsigned int) entries2[i].a_perm);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
287 return 1;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
288 }
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
289 }
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
290 }
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
291 # ifdef ACE_GETACL
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
292 count1 = acl (file1, ACE_GETACLCNT, 0, NULL);
10141
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
293 if (count1 < 0 && errno == EINVAL)
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
294 count1 = 0;
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
295 count2 = acl (file2, ACE_GETACLCNT, 0, NULL);
10141
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
296 if (count2 < 0 && errno == EINVAL)
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
297 count2 = 0;
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
298 if (count1 < 0)
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
299 {
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
300 fprintf (stderr, "error accessing the ACE-ACLs of file %s\n", file1);
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
301 fflush (stderr);
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
302 abort ();
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
303 }
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
304 if (count2 < 0)
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
305 {
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
306 fprintf (stderr, "error accessing the ACE-ACLs of file %s\n", file2);
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
307 fflush (stderr);
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
308 abort ();
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
309 }
16381
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
310 {
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
311 ace_t *entries1 = XNMALLOC (count1, ace_t);
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
312 ace_t *entries2 = XNMALLOC (count2, ace_t);
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
313 int ret;
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
314 int i;
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
315
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
316 ret = acl (file1, ACE_GETACL, count1, entries1);
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
317 if (ret < 0 && errno == EINVAL)
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
318 count1 = 0;
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
319 else if (ret < count1)
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
320 {
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
321 fprintf (stderr, "error retrieving the ACE-ACLs of file %s\n", file1);
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
322 fflush (stderr);
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
323 abort ();
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
324 }
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
325 ret = acl (file2, ACE_GETACL, count2, entries2);
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
326 if (ret < 0 && errno == EINVAL)
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
327 count2 = 0;
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
328 else if (ret < count2)
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
329 {
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
330 fprintf (stderr, "error retrieving the ACE-ACLs of file %s\n", file2);
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
331 fflush (stderr);
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
332 abort ();
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
333 }
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
334
16381
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
335 if (count1 != count2)
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
336 {
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
337 fprintf (stderr, "files %s and %s have different number of ACE-ACLs: %d and %d\n",
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
338 file1, file2, count1, count2);
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
339 return 1;
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
340 }
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
341
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
342 for (i = 0; i < count1; i++)
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
343 {
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
344 if (entries1[i].a_type != entries2[i].a_type)
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
345 {
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
346 fprintf (stderr, "files %s and %s: different ACE-ACL entry #%d: different types %d and %d\n",
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
347 file1, file2, i, entries1[i].a_type, entries2[i].a_type);
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
348 return 1;
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
349 }
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
350 if (entries1[i].a_who != entries2[i].a_who)
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
351 {
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
352 fprintf (stderr, "files %s and %s: different ACE-ACL entry #%d: different ids %d and %d\n",
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
353 file1, file2, i, (int)entries1[i].a_who, (int)entries2[i].a_who);
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
354 return 1;
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
355 }
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
356 if (entries1[i].a_access_mask != entries2[i].a_access_mask)
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
357 {
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
358 fprintf (stderr, "files %s and %s: different ACE-ACL entry #%d: different access masks %03o and %03o\n",
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
359 file1, file2, i, (unsigned int) entries1[i].a_access_mask, (unsigned int) entries2[i].a_access_mask);
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
360 return 1;
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
361 }
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
362 if (entries1[i].a_flags != entries2[i].a_flags)
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
363 {
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
364 fprintf (stderr, "files %s and %s: different ACE-ACL entry #%d: different flags 0x%x and 0x%x\n",
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
365 file1, file2, i, (unsigned int) entries1[i].a_flags, (unsigned int) entries2[i].a_flags);
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
366 return 1;
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
367 }
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
368 }
fc5c37ccbece acl: Fix endless loop on Solaris with vxfs.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
369 }
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
370 # endif
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
371 #elif HAVE_GETACL /* HP-UX */
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
372 int count1;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
373 int count2;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
374
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
375 count1 = getacl (file1, 0, NULL);
14904
812be65b0e8b acl: Complete the 2010-08-10 fix.
Bruno Haible <bruno@clisp.org>
parents: 14898
diff changeset
376 if (count1 < 0
812be65b0e8b acl: Complete the 2010-08-10 fix.
Bruno Haible <bruno@clisp.org>
parents: 14898
diff changeset
377 && (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP))
10141
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
378 count1 = 0;
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
379 count2 = getacl (file2, 0, NULL);
14904
812be65b0e8b acl: Complete the 2010-08-10 fix.
Bruno Haible <bruno@clisp.org>
parents: 14898
diff changeset
380 if (count2 < 0
812be65b0e8b acl: Complete the 2010-08-10 fix.
Bruno Haible <bruno@clisp.org>
parents: 14898
diff changeset
381 && (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP))
10141
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
382 count2 = 0;
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
383
10141
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
384 if (count1 < 0)
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
385 {
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
386 fprintf (stderr, "error accessing the ACLs of file %s\n", file1);
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
387 fflush (stderr);
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
388 abort ();
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
389 }
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
390 if (count2 < 0)
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
391 {
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
392 fprintf (stderr, "error accessing the ACLs of file %s\n", file2);
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
393 fflush (stderr);
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
394 abort ();
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
395 }
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
396 if (count1 != count2)
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
397 {
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
398 fprintf (stderr, "files %s and %s have different number of ACLs: %d and %d\n",
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
399 file1, file2, count1, count2);
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
400 return 1;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
401 }
10141
69c854126601 Portability fixes for MacOS X, Solaris, HP-UX, IRIX.
Bruno Haible <bruno@clisp.org>
parents: 10118
diff changeset
402 else if (count1 > 0)
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
403 {
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
404 struct acl_entry *entries1 = XNMALLOC (count1, struct acl_entry);
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
405 struct acl_entry *entries2 = XNMALLOC (count2, struct acl_entry);
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
406 int i;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
407
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
408 if (getacl (file1, count1, entries1) < count1)
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
409 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
410 fprintf (stderr, "error retrieving the ACLs of file %s\n", file1);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
411 fflush (stderr);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
412 abort ();
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
413 }
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
414 if (getacl (file2, count2, entries2) < count1)
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
415 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
416 fprintf (stderr, "error retrieving the ACLs of file %s\n", file2);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
417 fflush (stderr);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
418 abort ();
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
419 }
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
420 for (i = 0; i < count1; i++)
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
421 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
422 if (entries1[i].uid != entries2[i].uid)
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
423 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
424 fprintf (stderr, "files %s and %s: different ACL entry #%d: different uids %d and %d\n",
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
425 file1, file2, i, (int)entries1[i].uid, (int)entries2[i].uid);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
426 return 1;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
427 }
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
428 if (entries1[i].gid != entries2[i].gid)
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
429 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
430 fprintf (stderr, "files %s and %s: different ACL entry #%d: different gids %d and %d\n",
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
431 file1, file2, i, (int)entries1[i].gid, (int)entries2[i].gid);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
432 return 1;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
433 }
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
434 if (entries1[i].mode != entries2[i].mode)
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
435 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
436 fprintf (stderr, "files %s and %s: different ACL entry #%d: different permissions %03o and %03o\n",
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
437 file1, file2, i, (unsigned int) entries1[i].mode, (unsigned int) entries2[i].mode);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
438 return 1;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
439 }
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
440 }
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
441 }
14905
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
442
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
443 # if HAVE_ACLV_H /* HP-UX >= 11.11 */
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
444 {
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
445 struct acl dummy_entries[NACLVENTRIES];
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
446
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
447 count1 = acl ((char *) file1, ACL_CNT, NACLVENTRIES, dummy_entries);
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
448 if (count1 < 0
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
449 && (errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL))
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
450 count1 = 0;
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
451 count2 = acl ((char *) file2, ACL_CNT, NACLVENTRIES, dummy_entries);
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
452 if (count2 < 0
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
453 && (errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL))
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
454 count2 = 0;
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
455 }
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
456
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
457 if (count1 < 0)
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
458 {
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
459 fprintf (stderr, "error accessing the ACLs of file %s\n", file1);
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
460 fflush (stderr);
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
461 abort ();
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
462 }
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
463 if (count2 < 0)
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
464 {
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
465 fprintf (stderr, "error accessing the ACLs of file %s\n", file2);
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
466 fflush (stderr);
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
467 abort ();
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
468 }
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
469 if (count1 != count2)
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
470 {
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
471 fprintf (stderr, "files %s and %s have different number of ACLs: %d and %d\n",
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
472 file1, file2, count1, count2);
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
473 return 1;
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
474 }
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
475 else if (count1 > 0)
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
476 {
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
477 struct acl *entries1 = XNMALLOC (count1, struct acl);
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
478 struct acl *entries2 = XNMALLOC (count2, struct acl);
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
479 int i;
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
480
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
481 if (acl ((char *) file1, ACL_GET, count1, entries1) < count1)
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
482 {
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
483 fprintf (stderr, "error retrieving the ACLs of file %s\n", file1);
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
484 fflush (stderr);
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
485 abort ();
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
486 }
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
487 if (acl ((char *) file2, ACL_GET, count2, entries2) < count1)
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
488 {
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
489 fprintf (stderr, "error retrieving the ACLs of file %s\n", file2);
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
490 fflush (stderr);
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
491 abort ();
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
492 }
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
493 for (i = 0; i < count1; i++)
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
494 {
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
495 if (entries1[i].a_type != entries2[i].a_type)
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
496 {
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
497 fprintf (stderr, "files %s and %s: different ACL entry #%d: different types %d and %d\n",
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
498 file1, file2, i, entries1[i].a_type, entries2[i].a_type);
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
499 return 1;
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
500 }
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
501 if (entries1[i].a_id != entries2[i].a_id)
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
502 {
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
503 fprintf (stderr, "files %s and %s: different ACL entry #%d: different ids %d and %d\n",
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
504 file1, file2, i, (int)entries1[i].a_id, (int)entries2[i].a_id);
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
505 return 1;
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
506 }
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
507 if (entries1[i].a_perm != entries2[i].a_perm)
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
508 {
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
509 fprintf (stderr, "files %s and %s: different ACL entry #%d: different permissions %03o and %03o\n",
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
510 file1, file2, i, (unsigned int) entries1[i].a_perm, (unsigned int) entries2[i].a_perm);
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
511 return 1;
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
512 }
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
513 }
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
514 }
a9b67d6b93df acl: Add support for HP-UX >= 11.11 JFS ACLs.
Bruno Haible <bruno@clisp.org>
parents: 14904
diff changeset
515 # endif
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
516 #elif HAVE_ACLX_GET /* AIX */
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
517 acl_type_t type1;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
518 char acl1[1000];
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
519 size_t aclsize1 = sizeof (acl1);
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
520 mode_t mode1;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
521 char text1[1000];
14871
82d665ed443a acl: Fix test failure on AIX 7.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
522 size_t textsize1 = sizeof (text1);
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
523 acl_type_t type2;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
524 char acl2[1000];
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
525 size_t aclsize2 = sizeof (acl2);
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
526 mode_t mode2;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
527 char text2[1000];
14871
82d665ed443a acl: Fix test failure on AIX 7.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
528 size_t textsize2 = sizeof (text2);
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
529
12075
c57301f2214b Add support for new flavours of ACLs on AIX. (Untested.)
Bruno Haible <bruno@clisp.org>
parents: 10635
diff changeset
530 /* The docs say that type1 being 0 is equivalent to ACL_ANY, but it is not
c57301f2214b Add support for new flavours of ACLs on AIX. (Untested.)
Bruno Haible <bruno@clisp.org>
parents: 10635
diff changeset
531 true, in AIX 5.3. */
c57301f2214b Add support for new flavours of ACLs on AIX. (Untested.)
Bruno Haible <bruno@clisp.org>
parents: 10635
diff changeset
532 type1.u64 = ACL_ANY;
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
533 if (aclx_get (file1, 0, &type1, acl1, &aclsize1, &mode1) < 0)
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
534 {
15576
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
535 if (errno == ENOSYS)
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
536 text1[0] = '\0';
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
537 else
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
538 {
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
539 fprintf (stderr, "error accessing the ACLs of file %s\n", file1);
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
540 fflush (stderr);
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
541 abort ();
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
542 }
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
543 }
15576
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
544 else
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
545 if (aclx_printStr (text1, &textsize1, acl1, aclsize1, type1, file1, 0) < 0)
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
546 {
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
547 fprintf (stderr, "cannot convert the ACLs of file %s to text\n", file1);
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
548 fflush (stderr);
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
549 abort ();
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
550 }
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
551
12076
bd0ab8b4fe70 Typo in comment.
Bruno Haible <bruno@clisp.org>
parents: 12075
diff changeset
552 /* The docs say that type2 being 0 is equivalent to ACL_ANY, but it is not
12075
c57301f2214b Add support for new flavours of ACLs on AIX. (Untested.)
Bruno Haible <bruno@clisp.org>
parents: 10635
diff changeset
553 true, in AIX 5.3. */
c57301f2214b Add support for new flavours of ACLs on AIX. (Untested.)
Bruno Haible <bruno@clisp.org>
parents: 10635
diff changeset
554 type2.u64 = ACL_ANY;
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
555 if (aclx_get (file2, 0, &type2, acl2, &aclsize2, &mode2) < 0)
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
556 {
15576
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
557 if (errno == ENOSYS)
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
558 text2[0] = '\0';
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
559 else
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
560 {
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
561 fprintf (stderr, "error accessing the ACLs of file %s\n", file2);
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
562 fflush (stderr);
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
563 abort ();
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
564 }
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
565 }
15576
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
566 else
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
567 if (aclx_printStr (text2, &textsize2, acl2, aclsize2, type2, file2, 0) < 0)
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
568 {
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
569 fprintf (stderr, "cannot convert the ACLs of file %s to text\n", file2);
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
570 fflush (stderr);
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
571 abort ();
5108c363f278 acl: Fix a test failure on AIX >= 5.3 with NFS.
Bruno Haible <bruno@clisp.org>
parents: 14905
diff changeset
572 }
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
573
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
574 if (strcmp (text1, text2) != 0)
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
575 {
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
576 fprintf (stderr, "files %s and %s have different ACLs:\n%s\n%s\n",
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
577 file1, file2, text1, text2);
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
578 return 1;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
579 }
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
580 #elif HAVE_STATACL /* older AIX */
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
581 union { struct acl a; char room[4096]; } acl1;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
582 union { struct acl a; char room[4096]; } acl2;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
583 unsigned int i;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
584
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
585 if (statacl (file1, STX_NORMAL, &acl1.a, sizeof (acl1)) < 0)
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
586 {
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
587 fprintf (stderr, "error accessing the ACLs of file %s\n", file1);
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
588 fflush (stderr);
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
589 abort ();
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
590 }
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
591 if (statacl (file2, STX_NORMAL, &acl2.a, sizeof (acl2)) < 0)
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
592 {
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
593 fprintf (stderr, "error accessing the ACLs of file %s\n", file2);
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
594 fflush (stderr);
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
595 abort ();
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
596 }
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
597
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
598 if (acl1.a.acl_len != acl2.a.acl_len)
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
599 {
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
600 fprintf (stderr, "files %s and %s have different ACL lengths: %u and %u\n",
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
601 file1, file2, acl1.a.acl_len, acl2.a.acl_len);
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
602 return 1;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
603 }
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
604 if (acl1.a.acl_mode != acl2.a.acl_mode)
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
605 {
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
606 fprintf (stderr, "files %s and %s have different ACL modes: %03o and %03o\n",
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
607 file1, file2, acl1.a.acl_mode, acl2.a.acl_mode);
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
608 return 1;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
609 }
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
610 if (acl1.a.u_access != acl2.a.u_access
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
611 || acl1.a.g_access != acl2.a.g_access
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
612 || acl1.a.o_access != acl2.a.o_access)
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
613 {
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
614 fprintf (stderr, "files %s and %s have different ACL access masks: %03o %03o %03o and %03o %03o %03o\n",
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
615 file1, file2,
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
616 acl1.a.u_access, acl1.a.g_access, acl1.a.o_access,
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
617 acl2.a.u_access, acl2.a.g_access, acl2.a.o_access);
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
618 return 1;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
619 }
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
620 if (memcmp (acl1.a.acl_ext, acl2.a.acl_ext, acl1.a.acl_len) != 0)
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
621 {
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
622 fprintf (stderr, "files %s and %s have different ACL entries\n",
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12076
diff changeset
623 file1, file2);
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
624 return 1;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
625 }
13757
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
626 #elif HAVE_ACLSORT /* NonStop Kernel */
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
627 int count1;
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
628 int count2;
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
629
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
630 count1 = acl ((char *) file1, ACL_CNT, NACLENTRIES, NULL);
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
631 count2 = acl ((char *) file2, ACL_CNT, NACLENTRIES, NULL);
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
632
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
633 if (count1 < 0)
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
634 {
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
635 fprintf (stderr, "error accessing the ACLs of file %s\n", file1);
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
636 fflush (stderr);
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
637 abort ();
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
638 }
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
639 if (count2 < 0)
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
640 {
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
641 fprintf (stderr, "error accessing the ACLs of file %s\n", file2);
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
642 fflush (stderr);
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
643 abort ();
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
644 }
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
645 if (count1 != count2)
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
646 {
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
647 fprintf (stderr, "files %s and %s have different number of ACLs: %d and %d\n",
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
648 file1, file2, count1, count2);
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
649 return 1;
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
650 }
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
651 else if (count1 > 0)
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
652 {
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
653 struct acl *entries1 = XNMALLOC (count1, struct acl);
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
654 struct acl *entries2 = XNMALLOC (count2, struct acl);
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
655 int i;
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
656
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
657 if (acl ((char *) file1, ACL_GET, count1, entries1) < count1)
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
658 {
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
659 fprintf (stderr, "error retrieving the ACLs of file %s\n", file1);
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
660 fflush (stderr);
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
661 abort ();
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
662 }
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
663 if (acl ((char *) file2, ACL_GET, count2, entries2) < count1)
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
664 {
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
665 fprintf (stderr, "error retrieving the ACLs of file %s\n", file2);
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
666 fflush (stderr);
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
667 abort ();
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
668 }
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
669 for (i = 0; i < count1; i++)
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
670 {
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
671 if (entries1[i].a_type != entries2[i].a_type)
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
672 {
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
673 fprintf (stderr, "files %s and %s: different ACL entry #%d: different types %d and %d\n",
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
674 file1, file2, i, entries1[i].a_type, entries2[i].a_type);
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
675 return 1;
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
676 }
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
677 if (entries1[i].a_id != entries2[i].a_id)
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
678 {
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
679 fprintf (stderr, "files %s and %s: different ACL entry #%d: different ids %d and %d\n",
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
680 file1, file2, i, (int)entries1[i].a_id, (int)entries2[i].a_id);
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
681 return 1;
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
682 }
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
683 if (entries1[i].a_perm != entries2[i].a_perm)
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
684 {
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
685 fprintf (stderr, "files %s and %s: different ACL entry #%d: different permissions %03o and %03o\n",
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
686 file1, file2, i, (unsigned int) entries1[i].a_perm, (unsigned int) entries2[i].a_perm);
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
687 return 1;
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
688 }
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
689 }
87aaf9340686 acl: Add support for ACLs on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
690 }
10118
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
691 #endif
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
692 }
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
693
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
694 return 0;
a771dc3b73d4 Rename tests/test-copy-file-sameacls.c to tests/test-sameacls.c.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
695 }