Deleted Added
full compact
test_owner_parse.c (228763) test_owner_parse.c (232153)
1/*-
2 * Copyright (c) 2003-2009 Tim Kientzle
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25#include "test.h"
1/*-
2 * Copyright (c) 2003-2009 Tim Kientzle
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25#include "test.h"
26__FBSDID("$FreeBSD: head/contrib/libarchive/cpio/test/test_owner_parse.c 228763 2011-12-21 11:13:29Z mm $");
26__FBSDID("$FreeBSD: head/contrib/libarchive/cpio/test/test_owner_parse.c 232153 2012-02-25 10:58:02Z mm $");
27
28#include "../cpio.h"
29#include "err.h"
30
31#if !defined(_WIN32)
32#define ROOT "root"
27
28#include "../cpio.h"
29#include "err.h"
30
31#if !defined(_WIN32)
32#define ROOT "root"
33static int root_uids[] = { 0 };
34/* Solaris 9 root has gid 1 (other) */
35static int root_gids[] = { 0, 1 };
33static const int root_uids[] = { 0 };
34static const int root_gids[] = { 0, 1 };
36#elif defined(__CYGWIN__)
37/* On cygwin, the Administrator user most likely exists (unless
38 * it has been renamed or is in a non-English localization), but
39 * its primary group membership depends on how the user set up
40 * their /etc/passwd. Likely values are 513 (None), 545 (Users),
41 * or 544 (Administrators). Just check for one of those...
42 * TODO: Handle non-English localizations...e.g. French 'Administrateur'
43 * Use CreateWellKnownSID() and LookupAccountName()?
44 */
45#define ROOT "Administrator"
35#elif defined(__CYGWIN__)
36/* On cygwin, the Administrator user most likely exists (unless
37 * it has been renamed or is in a non-English localization), but
38 * its primary group membership depends on how the user set up
39 * their /etc/passwd. Likely values are 513 (None), 545 (Users),
40 * or 544 (Administrators). Just check for one of those...
41 * TODO: Handle non-English localizations...e.g. French 'Administrateur'
42 * Use CreateWellKnownSID() and LookupAccountName()?
43 */
44#define ROOT "Administrator"
46static int root_uids[] = { 500 };
47static int root_gids[] = { 513, 545, 544 };
45static const int root_uids[] = { 500 };
46static const int root_gids[] = { 513, 545, 544 };
48#endif
49
50#if defined(ROOT)
51static int
47#endif
48
49#if defined(ROOT)
50static int
52int_in_list(int i, int *l, size_t n)
51int_in_list(int i, const int *l, size_t n)
53{
54 while (n-- > 0)
55 if (*l++ == i)
56 return (1);
57 failure("%d", i);
58 return (0);
59}
60#endif

--- 62 unchanged lines hidden ---
52{
53 while (n-- > 0)
54 if (*l++ == i)
55 return (1);
56 failure("%d", i);
57 return (0);
58}
59#endif

--- 62 unchanged lines hidden ---