Patch prepared by Daniel Richard G. <skunk@iSKUNK.ORG> against 
libarchive SVN on 2010 April 27.

The following are portability fixes/hacks to allow libarchive to build 
on Solaris 8 and Tru64 V4.0G using the native vendor compilers. These 
changes should also improve portability to other "exotic" systems.

* * * *

GENERAL: C++ comments are verboten in C code. GCC will accept it, some 
other C compilers will accept it, but strict/fussy C compilers will not.

GENERAL: The Solaris and Tru64 compilers complain about commas after the 
last element in an enum list. I got rid of them here, but you may also 
want to consider adding a last-element sentinel instead (makes for nicer 
diffs later on).

tar/test/test.h, tar/bsdtar_platform.h, cpio/test/test.h, 
cpio/cpio_platform.h, libarchive/test/test.h: Source files #including 
these headers need some C99 integer types (int64_t, uint64_t), so 
instead of copying definitions, I just #included archive_platform.h (to 
which I added some appropriate typedefs; see below).

libarchive/archive_endian.h: Please use AC_C_INLINE and its CMake 
equivalent. There is no good way to conditionalize the "inline" keyword 
using only feature test macros.

libarchive/archive_platform.h: Need to define int64_t and uint64_t. Note 
that the old Tru64 system I'm testing on does not have stdint.h or 
inttypes.h, or any definition whatsoever of u?int\d\d_t under 
/usr/include.

libarchive/archive_write_set_format_iso9660.c: Two issues:

* Solaris 8 supports both a 2- and 3-argument form of ctime_r(). For 
  whatever reason, it wanted to use the 3-arg form, which has the 
  following prototype:

	char *ctime_r(const time_t *clock, char *buf, int buflen);

* NAME_MAX is not #defined in limits.h. Instead, I see this comment:

/*
 * POSIX 1003.1a, section 2.9.5, table 2-5 contains [NAME_MAX] and the
 * related text states:
 *
 * A definition of one of the values from Table 2-5 shall be omitted from the
 * <limits.h> on specific implementations where the corresponding value is
 * equal to or greater than the stated minimum, but where the value can vary
 * depending on the file to which it is applied. The actual value supported for
 * a specific pathname shall be provided by the pathconf() (5.7.1) function.
 *
 * This is clear that any machine supporting multiple file system types
 * and/or a network can not include this define, regardless of protection
 * by the _POSIX_SOURCE and _POSIX_C_SOURCE flags.
 *
 * #define      NAME_MAX        14
 */

  I substituted _POSIX_NAME_MAX for a quick fix (which is #defined as 
  14, incidentally), but I suspect the real fix would be to use 
  pathconf().

libarchive/test/test_write_format_*.c, libarchive/test/test_read_*.c: 
The linker complains about these "buff" and "buff2" symbols colliding 
when everything gets thrown into a library together, so I declared them 
as static.

libarchive/test/test.h: The C preprocessor in Sun's Workshop 6 compiler 
cannot stringify a wide-character string literal macro argument 
correctly. It stupidly turns e.g. L"foo" into "L"foo"", which then 
causes an illegal-token error. I would suggest tweaking the 
assertion_equal_wstring() function to take a wide-character string 
instead of a normal-character stringified form of it.

libarchive/archive_read_disk_set_standard_lookup.c: Solaris 8 supports 
both a 4- and 5-argument form of getpwuid_r(), and wanted to use the 
4-arg form with the following prototype:

	struct passwd *getpwuid_r(uid_t uid, struct passwd *pwd,
				  char *buffer, int buflen);

Likewise with getgrgid_r():

	struct group *getgrgid_r(gid_t gid, struct group *grp,
				 char *buffer, int bufsize);

(Note that I did not fix anything as far as the return value is 
concerned, so while the patched code builds, it is still broken.)



Index: tar/test/main.c
===================================================================
--- tar/test/main.c	(revision 2323)
+++ tar/test/main.c	(working copy)
@@ -859,7 +859,7 @@
 		return (0);
 	}
 
-	// Make a copy of the provided lines and count up the expected file size.
+	/* Make a copy of the provided lines and count up the expected file size. */
 	expected_count = 0;
 	for (i = 0; lines[i] != NULL; ++i) {
 	}
@@ -869,7 +869,7 @@
 		expected[i] = strdup(lines[i]);
 	}
 
-	// Break the file into lines
+	/* Break the file into lines */
 	actual_count = 0;
 	for (c = '\0', p = buff; p < buff + buff_size; ++p) {
 		if (*p == '\x0d' || *p == '\x0a')
@@ -886,7 +886,7 @@
 		}
 	}
 
-	// Erase matching lines from both lists
+	/* Erase matching lines from both lists */
 	for (i = 0; i < expected_count; ++i) {
 		if (expected[i] == NULL)
 			continue;
@@ -902,7 +902,7 @@
 		}
 	}
 
-	// If there's anything left, it's a failure
+	/* If there's anything left, it's a failure */
 	for (i = 0; i < expected_count; ++i) {
 		if (expected[i] != NULL)
 			++expected_failure;
Index: tar/test/test.h
===================================================================
--- tar/test/test.h	(revision 2323)
+++ tar/test/test.h	(working copy)
@@ -45,6 +45,8 @@
 #error Oops: No config.h and no pre-built configuration in test.h.
 #endif
 
+#include "archive_platform.h" /* HACK */
+
 #include <sys/types.h>  /* Windows requires this before sys/stat.h */
 #include <sys/stat.h>
 
Index: tar/tree.c
===================================================================
--- tar/tree.c	(revision 2323)
+++ tar/tree.c	(working copy)
@@ -305,8 +305,8 @@
 	/* printf("Looking for wildcard in %s\n", path); */
 	/* TODO: wildcard detection here screws up on \\?\c:\ UNC names */
 	if (strchr(base, '*') || strchr(base, '?')) {
-		// It has a wildcard in it...
-		// Separate the last element.
+		/* It has a wildcard in it... */
+		/* Separate the last element. */
 		p = strrchr(base, '/');
 		if (p != NULL) {
 			*p = '\0';
@@ -428,13 +428,13 @@
 					continue;
 				return (r);
 			}
-			// Not a pattern, handle it as-is...
+			/* Not a pattern, handle it as-is... */
 #endif
 			/* Top stack item needs a regular visit. */
 			t->current = t->stack;
 			tree_append(t, t->stack->name, strlen(t->stack->name));
-			//t->dirname_length = t->path_length;
-			//tree_pop(t);
+			/*t->dirname_length = t->path_length;*/
+			/*tree_pop(t);*/
 			t->stack->flags &= ~needsFirstVisit;
 			return (t->visit_type = TREE_REGULAR);
 		} else if (t->stack->flags & needsDescent) {
Index: tar/read.c
===================================================================
--- tar/read.c	(revision 2323)
+++ tar/read.c	(working copy)
@@ -297,7 +297,7 @@
 				fflush(stderr);
 			}
 
-			// TODO siginfo_printinfo(bsdtar, 0);
+			/* TODO siginfo_printinfo(bsdtar, 0); */
 
 			if (bsdtar->option_stdout)
 				r = archive_read_data_into_fd(a, 1);
Index: tar/bsdtar_platform.h
===================================================================
--- tar/bsdtar_platform.h	(revision 2323)
+++ tar/bsdtar_platform.h	(working copy)
@@ -58,6 +58,7 @@
 #include <archive_entry.h>
 #else
 /* Otherwise, include user headers. */
+#include "archive_platform.h" /* HACK */
 #include "archive.h"
 #include "archive_entry.h"
 #endif
Index: cpio/test/test.h
===================================================================
--- cpio/test/test.h	(revision 2323)
+++ cpio/test/test.h	(working copy)
@@ -45,6 +45,8 @@
 #error Oops: No config.h and no pre-built configuration in test.h.
 #endif
 
+#include "archive_platform.h" /* HACK */
+
 #include <sys/types.h>  /* Windows requires this before sys/stat.h */
 #include <sys/stat.h>
 
Index: cpio/cpio_platform.h
===================================================================
--- cpio/cpio_platform.h	(revision 2323)
+++ cpio/cpio_platform.h	(working copy)
@@ -58,6 +58,7 @@
 #include <archive_entry.h>
 #else
 /* Otherwise, include user headers. */
+#include "archive_platform.h" /* HACK */
 #include "archive.h"
 #include "archive_entry.h"
 #endif
Index: cpio/cpio.c
===================================================================
--- cpio/cpio.c	(revision 2323)
+++ cpio/cpio.c	(working copy)
@@ -1270,8 +1270,8 @@
 const char *
 cpio_i64toa(int64_t n0)
 {
-	// 2^64 =~ 1.8 * 10^19, so 20 decimal digits suffice.
-	// We also need 1 byte for '-' and 1 for '\0'.
+	/* 2^64 =~ 1.8 * 10^19, so 20 decimal digits suffice. */
+	/* We also need 1 byte for '-' and 1 for '\0'. */
 	static char buff[22];
 	int64_t n = n0 < 0 ? -n0 : n0;
 	char *p = buff + sizeof(buff);
Index: libarchive/archive_endian.h
===================================================================
--- libarchive/archive_endian.h	(revision 2323)
+++ libarchive/archive_endian.h	(working copy)
@@ -45,7 +45,7 @@
  * - SGI MIPSpro
  * - Microsoft Visual C++ 6.0 (supposedly newer versions too)
  */
-#if defined(__WATCOMC__) || defined(__sgi) || defined(__hpux) || defined(__BORLANDC__)
+#if defined(__WATCOMC__) || defined(__sgi) || defined(__hpux) || defined(__BORLANDC__) ||1 /* HACK */
 #define	inline
 #elif defined(_MSC_VER)
 #define inline __inline
Index: libarchive/archive_check_magic.c
===================================================================
--- libarchive/archive_check_magic.c	(revision 2323)
+++ libarchive/archive_check_magic.c	(working copy)
@@ -139,11 +139,11 @@
 			    write_all_states(states2, state));
 		a->state = ARCHIVE_STATE_FATAL;
 #if ARCHIVE_VERSION_NUMBER < 3000000
-		// XXXX This should be identical to the old behavior.
+		/* XXXX This should be identical to the old behavior. */
 		errmsg(archive_error_string(a));
 		diediedie();
 #else
-		// XXXX This is the proposed new behavior.
+		/* XXXX This is the proposed new behavior. */
 		return (ARCHIVE_FATAL);
 #endif
 	}
Index: libarchive/archive_platform.h
===================================================================
--- libarchive/archive_platform.h	(revision 2323)
+++ libarchive/archive_platform.h	(working copy)
@@ -83,6 +83,11 @@
 #if HAVE_STDINT_H
 #include <stdint.h>
 #endif
+#ifdef __osf__
+#  undef __LA_STDINT_H
+typedef	long long int64_t;
+typedef	unsigned long long uint64_t;
+#endif /* __osf	*/
 
 /* Borland warns about its own constants!  */
 #if defined(__BORLANDC__)
Index: libarchive/archive_write.c
===================================================================
--- libarchive/archive_write.c	(revision 2323)
+++ libarchive/archive_write.c	(working copy)
@@ -481,7 +481,7 @@
 	    "archive_write_close");
 	if (a->archive.state == ARCHIVE_STATE_NEW
 	    || a->archive.state == ARCHIVE_STATE_CLOSED)
-		return (ARCHIVE_OK); // Okay to close() when not open.
+		return (ARCHIVE_OK); /* Okay to close() when not open. */
 
 	archive_clear_error(&a->archive);
 
Index: libarchive/archive.h
===================================================================
--- libarchive/archive.h	(revision 2323)
+++ libarchive/archive.h	(working copy)
@@ -40,6 +40,9 @@
 #elif !defined(__WATCOMC__) && !defined(_MSC_VER) && !defined(__INTERIX) && !defined(__BORLANDC__)
 # define __LA_STDINT_H <inttypes.h>
 #endif
+#ifdef __osf__
+#  undef __LA_STDINT_H /* HACK */
+#endif
 
 #include <sys/stat.h>
 #if ARCHIVE_VERSION_NUMBER < 3000000
Index: libarchive/archive_read.c
===================================================================
--- libarchive/archive_read.c	(revision 2323)
+++ libarchive/archive_read.c	(working copy)
@@ -1207,7 +1207,7 @@
 	if (skipped == request)
 		return (skipped);
 	/* We hit EOF before we satisfied the skip request. */
-	if (skipped < 0)  // Map error code to 0 for error message below.
+	if (skipped < 0)  /* Map error code to 0 for error message below. */
 		skipped = 0;
 	archive_set_error(&filter->archive->archive,
 	    ARCHIVE_ERRNO_MISC,
Index: libarchive/archive_write_set_format_iso9660.c
===================================================================
--- libarchive/archive_write_set_format_iso9660.c	(revision 2323)
+++ libarchive/archive_write_set_format_iso9660.c	(working copy)
@@ -191,7 +191,7 @@
 	enum {
 		NO = 0,
 		BOOT_CATALOG,
-		BOOT_IMAGE,
+		BOOT_IMAGE
 	} boot;
 
 	/*
@@ -836,7 +836,7 @@
 	DIR_REC_VD,		/* Stored in Volume Descriptor.	*/
 	DIR_REC_SELF,		/* Stored as Current Directory.	*/
 	DIR_REC_PARENT,		/* Stored as Parent Directory.	*/
-	DIR_REC_NORMAL,		/* Stored as Child.		*/
+	DIR_REC_NORMAL		/* Stored as Child.		*/
 };
 
 /*
@@ -846,7 +846,7 @@
 	VDC_STD,
 	VDC_LOWERCASE,
 	VDC_UCS2,
-	VDC_UCS2_DIRECT,
+	VDC_UCS2_DIRECT
 };
 
 /*
@@ -893,7 +893,7 @@
 
 enum char_type {
 	A_CHAR,
-	D_CHAR,
+	D_CHAR
 };
 
 
@@ -3766,7 +3766,7 @@
 	KEY_FLG,
 	KEY_STR,
 	KEY_INT,
-	KEY_HEX,
+	KEY_HEX
 };
 static void
 set_option_info(struct archive_string *info, int *opt, const char *key,
@@ -3837,7 +3837,11 @@
 #if defined(HAVE__CTIME64_S)
 	_ctime64_s(buf, sizeof(buf), &(iso9660->birth_time));
 #elif defined(HAVE_CTIME_R)
+#  ifdef __osf__
 	ctime_r(&(iso9660->birth_time), buf);
+#  else
+	ctime_r(&(iso9660->birth_time), buf, 0);
+#  endif
 #else
 	strncpy(buf, ctime(&(iso9660->birth_time)), sizeof(buf)-1);
 	buf[sizeof(buf)-1] = '\0';
@@ -5213,7 +5217,7 @@
 #if defined(_WIN32) && !defined(__CYGWIN__)
 	char name[_MAX_FNAME];/* Included null terminator size. */
 #else
-	char name[NAME_MAX+1];
+	char name[_POSIX_NAME_MAX+1];
 #endif
 	struct iso9660 *iso9660 = a->format_data;
 	struct isoent *dent, *np;
@@ -5374,7 +5378,7 @@
 #if defined(_WIN32) && !defined(__CYGWIN__)
 	char name[_MAX_FNAME];/* Included null terminator size. */
 #else
-	char name[NAME_MAX+1];
+	char name[_POSIX_NAME_MAX+1];
 #endif
 	struct isoent *isoent, *np;
 	int l;
Index: libarchive/archive_util.c
===================================================================
--- libarchive/archive_util.c	(revision 2323)
+++ libarchive/archive_util.c	(working copy)
@@ -249,7 +249,7 @@
 		 * (already detected format/filter-name) */
 		F_NAME,
 		/* Getting option-value. */
-		G_VALUE,
+		G_VALUE
 	} state;
 
 	p_org = p;
Index: libarchive/archive_read_support_format_iso9660.c
===================================================================
--- libarchive/archive_read_support_format_iso9660.c	(revision 2323)
+++ libarchive/archive_read_support_format_iso9660.c	(working copy)
@@ -2154,7 +2154,7 @@
 			heap->reqs[hole].file = file;
 			return (ARCHIVE_OK);
 		}
-		// Move parent into hole <==> move hole up tree.
+		/* Move parent into hole <==> move hole up tree. */
 		heap->reqs[hole] = heap->reqs[parent];
 		hole = parent;
 	}
@@ -2181,14 +2181,14 @@
 	/*
 	 * Rebalance the heap.
 	 */
-	a = 0; // Starting element and its offset
+	a = 0; /* Starting element and its offset */
 	a_offset = heap->reqs[a].offset;
 	for (;;) {
-		b = a + a + 1; // First child
+		b = a + a + 1; /* First child */
 		if (b >= heap->cnt)
 			return;
 		b_offset = heap->reqs[b].offset;
-		c = b + 1; // Use second child if it is smaller.
+		c = b + 1; /* Use second child if it is smaller. */
 		if (c < heap->cnt) {
 			c_offset = heap->reqs[c].offset;
 			if (c_offset < b_offset) {
@@ -2686,7 +2686,7 @@
 			heap->files[hole] = file;
 			return;
 		}
-		// Move parent into hole <==> move hole up tree.
+		/* Move parent into hole <==> move hole up tree. */
 		heap->files[hole] = heap->files[parent];
 		hole = parent;
 	}
@@ -2716,14 +2716,14 @@
 	/*
 	 * Rebalance the heap.
 	 */
-	a = 0; // Starting element and its heap key
+	a = 0; /* Starting element and its heap key */
 	a_key = heap->files[a]->key;
 	for (;;) {
-		b = a + a + 1; // First child
+		b = a + a + 1; /* First child */
 		if (b >= heap->used)
 			return (r);
 		b_key = heap->files[b]->key;
-		c = b + 1; // Use second child if it is smaller.
+		c = b + 1; /* Use second child if it is smaller. */
 		if (c < heap->used) {
 			c_key = heap->files[c]->key;
 			if (c_key < b_key) {
Index: libarchive/test/test_write_format_iso9660.c
===================================================================
--- libarchive/test/test_write_format_iso9660.c	(revision 2323)
+++ libarchive/test/test_write_format_iso9660.c	(working copy)
@@ -26,7 +26,7 @@
 #include "test.h"
 __FBSDID("$FreeBSD$");
 
-char buff2[64];
+static char buff2[64];
 DEFINE_TEST(test_write_format_iso9660)
 {
 	size_t buffsize = 1000000;
Index: libarchive/test/test_write_format_gnutar.c
===================================================================
--- libarchive/test/test_write_format_gnutar.c	(revision 2323)
+++ libarchive/test/test_write_format_gnutar.c	(working copy)
@@ -25,7 +25,7 @@
 #include "test.h"
 __FBSDID("$FreeBSD$");
 
-char buff2[64];
+static char buff2[64];
 
 /* Some names 1026 characters long */
 static const char *longfilename = "abcdefghijklmnopqrstuvwxyz"
Index: libarchive/test/test_write_format_ar.c
===================================================================
--- libarchive/test/test_write_format_ar.c	(revision 2323)
+++ libarchive/test/test_write_format_ar.c	(working copy)
@@ -28,8 +28,8 @@
 #include "test.h"
 __FBSDID("$FreeBSD: head/lib/libarchive/test/test_write_format_ar.c 189308 2009-03-03 17:02:51Z kientzle $");
 
-char buff[4096];
-char buff2[64];
+static char buff[4096];
+static char buff2[64];
 static char strtab[] = "abcdefghijklmn.o/\nggghhhjjjrrrttt.o/\niiijjjdddsssppp.o/\n";
 
 DEFINE_TEST(test_write_format_ar)
Index: libarchive/test/test.h
===================================================================
--- libarchive/test/test.h	(revision 2323)
+++ libarchive/test/test.h	(working copy)
@@ -45,6 +45,8 @@
 #error Oops: No config.h and no pre-built configuration in test.h.
 #endif
 
+#include "archive_platform.h" /* HACK */
+
 #include <sys/types.h>  /* Windows requires this before sys/stat.h */
 #include <sys/stat.h>
 
@@ -146,7 +148,7 @@
   assertion_equal_string(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
 /* As above, but v1 and v2 are wchar_t * */
 #define assertEqualWString(v1,v2)   \
-  assertion_equal_wstring(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
+  assertion_equal_wstring(__FILE__, __LINE__, (v1), #v1, (v2), /*#v2*/ "XXX", NULL)
 /* As above, but raw blocks of bytes. */
 #define assertEqualMem(v1, v2, l)	\
   assertion_equal_mem(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (l), #l, NULL)
Index: libarchive/test/test_write_format_pax.c
===================================================================
--- libarchive/test/test_write_format_pax.c	(revision 2323)
+++ libarchive/test/test_write_format_pax.c	(working copy)
@@ -25,7 +25,7 @@
 #include "test.h"
 __FBSDID("$FreeBSD$");
 
-char buff2[64];
+static char buff2[64];
 
 DEFINE_TEST(test_write_format_pax)
 {
Index: libarchive/test/test_write_format_iso9660_boot.c
===================================================================
--- libarchive/test/test_write_format_iso9660_boot.c	(revision 2323)
+++ libarchive/test/test_write_format_iso9660_boot.c	(working copy)
@@ -84,7 +84,7 @@
     "IN PRIMARY VOLUME DESCRIPTOR FOR CONTACT INFORMATION."
 };
 
-char buff2[1024];
+static char buff2[1024];
 
 static void
 _test_write_format_iso9660_boot(int write_info_tbl)
Index: libarchive/test/test_write_format_zip.c
===================================================================
--- libarchive/test/test_write_format_zip.c	(revision 2323)
+++ libarchive/test/test_write_format_zip.c	(working copy)
@@ -134,7 +134,7 @@
 	assertEqualInt(0, archive_entry_atime(ae));
 	assertEqualInt(0, archive_entry_ctime(ae));
 	assertEqualString("file", archive_entry_pathname(ae));
-	//assertEqualInt((S_IFREG | 0755), archive_entry_mode(ae));
+	/*assertEqualInt((S_IFREG | 0755), archive_entry_mode(ae));*/
 	assertEqualInt(0, archive_entry_size(ae));
 	assertEqualIntA(a, 8,
 	    archive_read_data(a, filedata, sizeof(filedata)));
@@ -153,7 +153,7 @@
 	assertEqualInt(0, archive_entry_atime(ae));
 	assertEqualInt(0, archive_entry_ctime(ae));
 	assertEqualString("file2", archive_entry_pathname(ae));
-	//assert((S_IFREG | 0755) == archive_entry_mode(ae));
+	/*assert((S_IFREG | 0755) == archive_entry_mode(ae));*/
 	assertEqualInt(0, archive_entry_size(ae));
 	assertEqualIntA(a, 4,
 	    archive_read_data(a, filedata, sizeof(filedata)));
@@ -168,7 +168,7 @@
 	assertEqualInt(0, archive_entry_atime(ae));
 	assertEqualInt(0, archive_entry_ctime(ae));
 	assertEqualString("dir/", archive_entry_pathname(ae));
-	//assertEqualInt((S_IFDIR | 0755), archive_entry_mode(ae));
+	/*assertEqualInt((S_IFDIR | 0755), archive_entry_mode(ae));*/
 	assertEqualInt(0, archive_entry_size(ae));
 	assertEqualIntA(a, 0, archive_read_data(a, filedata, 10));
 
Index: libarchive/test/test_read_truncated.c
===================================================================
--- libarchive/test/test_read_truncated.c	(revision 2323)
+++ libarchive/test/test_read_truncated.c	(working copy)
@@ -25,8 +25,8 @@
 #include "test.h"
 __FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_truncated.c,v 1.4 2008/09/01 05:38:33 kientzle Exp $");
 
-char buff[1000000];
-char buff2[100000];
+static char buff[1000000];
+static char buff2[100000];
 
 DEFINE_TEST(test_read_truncated)
 {
Index: libarchive/test/test_entry.c
===================================================================
--- libarchive/test/test_entry.c	(revision 2323)
+++ libarchive/test/test_entry.c	(working copy)
@@ -773,8 +773,8 @@
 		archive_entry_copy_pathname(e, "abc\314\214mno\374xyz");
 		failure("Converting invalid chars to Unicode should fail.");
 		assert(NULL == archive_entry_pathname_w(e));
-		//failure("Converting invalid chars to UTF-8 should fail.");
-		//assert(NULL == archive_entry_pathname_utf8(e));
+		/*failure("Converting invalid chars to UTF-8 should fail.");*/
+		/*assert(NULL == archive_entry_pathname_utf8(e));*/
 
 		/* A group name that cannot be converted. */
 		archive_entry_copy_gname(e, "abc\314\214mno\374xyz");
Index: libarchive/test/test_read_data_large.c
===================================================================
--- libarchive/test/test_read_data_large.c	(revision 2323)
+++ libarchive/test/test_read_data_large.c	(working copy)
@@ -38,9 +38,9 @@
 #define close _close
 #endif
 
-char buff1[11000000];
-char buff2[10000000];
-char buff3[10000000];
+static char buff1[11000000];
+static char buff2[10000000];
+static char buff3[10000000];
 
 DEFINE_TEST(test_read_data_large)
 {
Index: libarchive/test/test_write_format_iso9660_zisofs.c
===================================================================
--- libarchive/test/test_write_format_iso9660_zisofs.c	(revision 2323)
+++ libarchive/test/test_write_format_iso9660_zisofs.c	(working copy)
@@ -57,7 +57,7 @@
     0x18, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00
 };
 
-char buff2[1024];
+static char buff2[1024];
 DEFINE_TEST(test_write_format_iso9660_zisofs)
 {
 	unsigned char nullb[1024];
@@ -219,7 +219,7 @@
 	 */
 	assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
 	assertEqualInt(2, archive_entry_atime(ae));
-	//assertEqualInt(3, archive_entry_birthtime(ae));
+	/*assertEqualInt(3, archive_entry_birthtime(ae));*/
 	assertEqualInt(4, archive_entry_ctime(ae));
 	assertEqualInt(5, archive_entry_mtime(ae));
 	assertEqualString("file1", archive_entry_pathname(ae));
@@ -233,7 +233,7 @@
 	 */
 	assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
 	assertEqualInt(2, archive_entry_atime(ae));
-	//assertEqualInt(3, archive_entry_birthtime(ae));
+	/*assertEqualInt(3, archive_entry_birthtime(ae));*/
 	assertEqualInt(4, archive_entry_ctime(ae));
 	assertEqualInt(5, archive_entry_mtime(ae));
 	assertEqualString("file2", archive_entry_pathname(ae));
@@ -247,7 +247,7 @@
 	 */
 	assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
 	assertEqualInt(2, archive_entry_atime(ae));
-	//assertEqualInt(3, archive_entry_birthtime(ae));
+	/*assertEqualInt(3, archive_entry_birthtime(ae));*/
 	assertEqualInt(4, archive_entry_ctime(ae));
 	assertEqualInt(5, archive_entry_mtime(ae));
 	assertEqualString("file3", archive_entry_pathname(ae));
@@ -261,7 +261,7 @@
 	 */
 	assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
 	assertEqualInt(2, archive_entry_atime(ae));
-	//assertEqualInt(3, archive_entry_birthtime(ae));
+	/*assertEqualInt(3, archive_entry_birthtime(ae));*/
 	assertEqualInt(4, archive_entry_ctime(ae));
 	assertEqualInt(5, archive_entry_mtime(ae));
 	assertEqualString("file4", archive_entry_pathname(ae));
Index: libarchive/test/test_write_format_tar.c
===================================================================
--- libarchive/test/test_write_format_tar.c	(revision 2323)
+++ libarchive/test/test_write_format_tar.c	(working copy)
@@ -25,8 +25,8 @@
 #include "test.h"
 __FBSDID("$FreeBSD: head/lib/libarchive/test/test_write_format_tar.c 189308 2009-03-03 17:02:51Z kientzle $");
 
-char buff[1000000];
-char buff2[64];
+static char buff[1000000];
+static char buff2[64];
 
 DEFINE_TEST(test_write_format_tar)
 {
Index: libarchive/test/test_write_compress_program.c
===================================================================
--- libarchive/test/test_write_compress_program.c	(revision 2323)
+++ libarchive/test/test_write_compress_program.c	(working copy)
@@ -25,8 +25,8 @@
 #include "test.h"
 __FBSDID("$FreeBSD: head/lib/libarchive/test/test_write_compress_program.c 201247 2009-12-30 05:59:21Z kientzle $");
 
-char buff[1000000];
-char buff2[64];
+static char buff[1000000];
+static char buff2[64];
 
 DEFINE_TEST(test_write_compress_program)
 {
Index: libarchive/archive_read_disk_set_standard_lookup.c
===================================================================
--- libarchive/archive_read_disk_set_standard_lookup.c	(revision 2323)
+++ libarchive/archive_read_disk_set_standard_lookup.c	(working copy)
@@ -206,8 +206,13 @@
 		return (NULL);
 	for (;;) {
 		result = &pwent; /* Old getpwuid_r ignores last arg. */
+#ifdef __osf__
 		r = getpwuid_r((uid_t)id, &pwent,
 			       cache->buff, cache->buff_size, &result);
+#else
+		r = getpwuid_r((uid_t)id, &pwent,
+			       cache->buff, cache->buff_size /*, &result*/);
+#endif
 		if (r == 0)
 			break;
 		if (r != ERANGE)
@@ -260,8 +265,13 @@
 		return (NULL);
 	for (;;) {
 		result = &grent; /* Old getgrgid_r ignores last arg. */
+#ifdef __osf__
 		r = getgrgid_r((gid_t)id, &grent,
 			       cache->buff, cache->buff_size, &result);
+#else
+		r = getgrgid_r((gid_t)id, &grent,
+			       cache->buff, cache->buff_size /*, &result*/);
+#endif
 		if (r == 0)
 			break;
 		if (r != ERANGE)
