blob: ce1bdf89a7730361406e1609f7138cf80b3796cb [file] [log] [blame]
diff --git a/Makefile.am b/Makefile.am
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,7 +24,7 @@ DISTCHECK_CONFIGURE_FLAGS = --enable-bsdtar --enable-bsdcpio
COMMON_CFLAGS=-Wall -Wformat -Wformat-security
# The next line is commented out by default in shipping libarchive releases.
# It is uncommented by default in trunk.
-DEV_CFLAGS=-Werror -Wextra -Wunused -Wshadow -Wmissing-prototypes -Wcast-qual -g
+# DEV_CFLAGS=-Werror -Wextra -Wunused -Wshadow -Wmissing-prototypes -Wcast-qual -g
AM_CFLAGS=$(COMMON_CFLAGS) $(DEV_CFLAGS)
PLATFORMCPPFLAGS = @PLATFORMCPPFLAGS@
AM_CPPFLAGS=$(PLATFORMCPPFLAGS)
diff --git a/libarchive/archive_random.c b/libarchive/archive_random.c
--- a/libarchive/archive_random.c
+++ b/libarchive/archive_random.c
@@ -34,6 +34,10 @@ __FBSDID("$FreeBSD$");
#ifdef HAVE_FCNTL
#include <fcntl.h>
+// TODO(cmihail): If possible remove this workaround for O_CLOEXEC.
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
#endif
#ifdef HAVE_LIMITS_H
#include <limits.h>
diff --git a/libarchive/archive_write_disk_posix.c b/libarchive/archive_write_disk_posix.c
--- a/libarchive/archive_write_disk_posix.c
+++ b/libarchive/archive_write_disk_posix.c
@@ -2740,7 +2740,7 @@ create_dir(struct archive_write_disk *a, char *path)
static int
set_ownership(struct archive_write_disk *a)
{
-#ifndef __CYGWIN__
+#if !defined(__CYGWIN__) && !defined(__native_client__)
/* unfortunately, on win32 there is no 'root' user with uid 0,
so we just have to try the chown and see if it works */
@@ -2792,7 +2792,8 @@ set_time(int fd, int mode, const char *name,
time_t mtime, long mtime_nsec)
{
/* Select the best implementation for this platform. */
-#if defined(HAVE_UTIMENSAT) && defined(HAVE_FUTIMENS)
+ /* futimens is not implemented in nacl glibc */
+#if defined(HAVE_UTIMENSAT) && defined(HAVE_FUTIMENS) && !defined(__native_client__)
/*
* utimensat() and futimens() are defined in
* POSIX.1-2008. They support ns resolution and setting times
diff --git a/libarchive_fe/passphrase.c b/libarchive_fe/passphrase.c
--- a/libarchive_fe/passphrase.c
+++ b/libarchive_fe/passphrase.c
@@ -142,7 +142,11 @@ readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags)
# define _POSIX_VDISABLE VDISABLE
#endif
+#ifdef _NEWLIB_VERSION
+static volatile sig_atomic_t signo[NSIG];
+#else
static volatile sig_atomic_t signo[_NSIG];
+#endif
static void
handler(int s)
@@ -168,7 +172,11 @@ readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags)
}
restart:
- for (i = 0; i < _NSIG; i++)
+#ifdef _NEWLIB_VERSION
+ for (i = 0; i < NSIG; i++)
+#else
+ for (i = 0; i < _NSIG; i++)
+#endif
signo[i] = 0;
nr = -1;
save_errno = 0;
@@ -273,7 +281,11 @@ restart:
* If we were interrupted by a signal, resend it to ourselves
* now that we have restored the signal handlers.
*/
- for (i = 0; i < _NSIG; i++) {
+#ifdef _NEWLIB_VERSION
+ for (i = 0; i < NSIG; i++) {
+#else
+ for (i = 0; i < _NSIG; i++) {
+#endif
if (signo[i]) {
kill(getpid(), i);
switch (i) {
@@ -311,4 +323,3 @@ lafe_readpassphrase(const char *prompt, char *buf, size_t bufsiz)
}
return (p);
}
-