From: Tim Kientzle Date: Mon, 5 May 2008 22:00:27 +0000 (-0400) Subject: Don't try to support external compression programs unless the local X-Git-Tag: v2.6.0~265 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3bb13e37def9fdcd0b4524265b5a952f38933e43;p=thirdparty%2Flibarchive.git Don't try to support external compression programs unless the local platform supports pipe(), vfork(), and fcntl(). SVN-Revision: 27 --- diff --git a/config.h.in b/config.h.in index 6226b894f..aa69378e3 100644 --- a/config.h.in +++ b/config.h.in @@ -114,6 +114,9 @@ /* Define to 1 if you have the `fchown' function. */ #undef HAVE_FCHOWN +/* Define to 1 if you have the `fcntl' function. */ +#undef HAVE_FCNTL + /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H @@ -244,6 +247,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_PATHS_H +/* Define to 1 if you have the `pipe' function. */ +#undef HAVE_PIPE + /* Define to 1 if you have the `poll' function. */ #undef HAVE_POLL @@ -382,6 +388,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UTIME_H +/* Define to 1 if you have the `vfork' function. */ +#undef HAVE_VFORK + /* Define to 1 if you have the `vprintf' function. */ #undef HAVE_VPRINTF diff --git a/configure.ac b/configure.ac index db9ab81ae..7ed5ed133 100644 --- a/configure.ac +++ b/configure.ac @@ -239,13 +239,13 @@ AC_FUNC_STAT AC_FUNC_STRERROR_R AC_FUNC_STRFTIME AC_FUNC_VPRINTF -AC_CHECK_FUNCS([chflags chown fchdir fchflags fchmod fchown fstat]) +AC_CHECK_FUNCS([chflags chown fchdir fchflags fchmod fchown fcntl fstat]) AC_CHECK_FUNCS([ftruncate futimes geteuid getopt_long getpid]) AC_CHECK_FUNCS([lchflags lchmod lchown]) AC_CHECK_FUNCS([lutimes memmove memset mkdir mkfifo mknod]) -AC_CHECK_FUNCS([nl_langinfo poll select setenv setlocale]) +AC_CHECK_FUNCS([nl_langinfo pipe poll select setenv setlocale]) AC_CHECK_FUNCS([strchr strdup strerror strrchr timegm]) -AC_CHECK_FUNCS([tzset unsetenv utime utimes]) +AC_CHECK_FUNCS([tzset unsetenv utime utimes vfork]) AC_CHECK_FUNCS([wcscpy wcslen wmemcmp wmemcpy]) # FreeBSD's nl_langinfo supports an option to specify whether the diff --git a/libarchive/archive_read_support_compression_program.c b/libarchive/archive_read_support_compression_program.c index 58b4bbddf..206215c89 100644 --- a/libarchive/archive_read_support_compression_program.c +++ b/libarchive/archive_read_support_compression_program.c @@ -26,6 +26,24 @@ #include "archive_platform.h" __FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_compression_program.c,v 1.2 2007/07/20 01:28:50 kientzle Exp $"); + +/* This capability is only available on POSIX systems. */ +#if !defined(HAVE_PIPE) || !defined(HAVE_VFORK) || !defined(HAVE_FCNTL) + +/* + * On non-Posix systems, allow the program to build, but choke if + * this function is actually invoked. + */ +int +archive_read_support_compression_program(struct archive *_a, const char *cmd) +{ + archive_set_error(_a, -1, + "External compression programs not supported on this platform"); + return (ARCHIVE_FATAL); +} + +#else + #ifdef HAVE_SYS_WAIT_H # include #endif @@ -313,3 +331,5 @@ archive_decompressor_program_finish(struct archive_read *a) return (ARCHIVE_OK); } + +#endif /* !defined(HAVE_PIPE) || !defined(HAVE_VFORK) || !defined(HAVE_FCNTL) */ diff --git a/libarchive/archive_windows.c b/libarchive/archive_windows.c new file mode 100644 index 000000000..486441cf6 --- /dev/null +++ b/libarchive/archive_windows.c @@ -0,0 +1,204 @@ +#ifdef _WIN32 + +#include +#include +#include +#include +#include +#include +#include +#include "archive_platform.h" +#include "libarchive-nonposix.h" + +/* Make a link to FROM called TO. */ +int link (from, to) + const char *from; + const char *to; +{ + int res; + + if (from == NULL || to == NULL) { + set_errno (EINVAL); + return -1; + } + + if (!_access (from, F_OK)) + res = CopyFile (from, to, FALSE); + else { + /* from doesn not exist; try to prepend it with the dirname of to */ + char *fullfrompath, *slash, *todir; + todir = strdup (to); + if (!todir) + return -1; + slash = strrchr(todir, '/'); + if (slash) + *slash = '\0'; + fullfrompath = malloc (strlen (from) + strlen (todir) + 2); + if (!fullfrompath) + return -1; + strcpy (fullfrompath, todir); + strcat (fullfrompath, "/"); + strcat (fullfrompath, from); + if (todir) + free (todir); + if (_access (fullfrompath, R_OK)) + return -1; + res = CopyFile (fullfrompath, to, FALSE); + if (fullfrompath) + free (fullfrompath); + } + + if (res == 0) { + set_errno (EINVAL); + return -1; + } + return 0; +} + +/* Make a symbolic link to FROM called TO. */ +int symlink (from, to) + const char *from; + const char *to; +{ + return link (from, to); +} + +static int get_dev_ino (HANDLE hFile, dev_t *dev, ino_t *ino) +{ +/* dev_t: short (2 bytes); ino_t: unsigned int (4 bytes) */ +#define LODWORD(l) ((DWORD)((DWORDLONG)(l))) +#define HIDWORD(l) ((DWORD)(((DWORDLONG)(l)>>32)&0xFFFFFFFF)) +#define MAKEDWORDLONG(a,b) ((DWORDLONG)(((DWORD)(a))|(((DWORDLONG)((DWORD)(b)))<<32))) + +#define INOSIZE (8*sizeof(ino_t)) /* 32 */ +//#define DEVSIZE (8*sizeof(dev_t)) /* 16 */ +#define SEQNUMSIZE (16) + + BY_HANDLE_FILE_INFORMATION FileInformation; + uint64_t ino64, FileReferenceNumber ; + ino_t resino; + dev_t resdev; + DWORD VolumeSerialNumber; + + *ino = 0; + *dev = 0; + if (hFile == INVALID_HANDLE_VALUE) /* file cannot be opened */ + return 0; + ZeroMemory (&FileInformation, sizeof(FileInformation)); + if (!GetFileInformationByHandle (hFile, &FileInformation)) /* cannot obtain FileInformation */ + return 0; + ino64 = (uint64_t) MAKEDWORDLONG ( + FileInformation.nFileIndexLow, FileInformation.nFileIndexHigh); + FileReferenceNumber = ino64 & ((~(0ULL)) >> SEQNUMSIZE); /* remove sequence number */ + /* transform 64-bits ino into 32-bits by hashing */ + resino = (ino_t) ( + ( (LODWORD(FileReferenceNumber)) ^ ((LODWORD(FileReferenceNumber)) >> INOSIZE) ) +// ^ +// ( (HIDWORD(FileReferenceNumber)) ^ ((HIDWORD(FileReferenceNumber)) >> INOSIZE) ) + ); + *ino = resino; + VolumeSerialNumber = FileInformation.dwVolumeSerialNumber; + //resdev = (unsigned short) ( (LOWORD(VolumeSerialNumber)) ^ ((HIWORD(VolumeSerialNumber)) >> DEVSIZE) ); + resdev = (dev_t) VolumeSerialNumber; + *dev = resdev; +//printf ("get_dev_ino: dev = %d; ino = %u\n", resdev, resino); + return 0; +} + +int get_dev_ino_fd (int fd, dev_t *dev, ino_t *ino) +{ + HANDLE hFile; + hFile = (HANDLE) _get_osfhandle (fd); + return get_dev_ino (hFile, dev, ino); +} + +int get_dev_ino_filename (char *path, dev_t *dev, ino_t *ino) +{ + HANDLE hFile; + int res; + if (!path || !*path) /* path = NULL */ + return 0; + if (_access (path, F_OK)) /* path does not exist */ + return -1; +/* obtain handle to file "name"; FILE_FLAG_BACKUP_SEMANTICS is used to open directories */ + hFile = CreateFile (path, 0, 0, NULL, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS | FILE_ATTRIBUTE_READONLY, + NULL); + res = get_dev_ino (hFile, dev, ino); + CloseHandle (hFile); + return res; +} + +int fstati64 (int fd, struct _stati64 *st) +{ + int res; + res = _fstati64 (fd, st); + if (res < 0) + return -1; + if (st->st_ino == 0) + res = get_dev_ino_fd (fd, &st->st_dev, &st->st_ino); +// printf ("fstat: dev = %u; ino = %u\n", st->st_dev, st->st_ino); + return res; +} + +int +setenv (name, value, replace) + const char *name; + const char *value; + int replace; +{ + char *string; + int res; + + if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) + { + set_errno (EINVAL); + return -1; + } + if (getenv (name) && !replace) + return -1; + + string = (char *) malloc (strlen(name) + strlen(value) + 2); + if (!string) + return -1; + strcpy (string, name); + strcat (string, "="); + strcat (string, value); + res = _putenv (string); + free (string); + return res; +} + +int +unsetenv (name) + const char *name; +{ + char *string; + int res; + + if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) + { + set_errno (EINVAL); + return -1; + } + string = (char *) malloc (strlen(name) + 2); + if (!string) + return -1; + strcpy (string, name); + strcat (string, "="); + res = _putenv (string); + free (string); + return res; +} + +int mkstemp(char *template) +{ + char *tmpfilename; + +// fprintf (stderr, "mkstemp: template = %s\n", template); + tmpfilename = mktemp (template); +// fprintf (stderr, "mkstemp: tmpfilename = %s\n", tmpfilename); + return open (tmpfilename, O_CREAT | O_EXCL | O_RDWR | O_BINARY); +} + +#endif /* _WIN32 */ diff --git a/libarchive/archive_windows.h b/libarchive/archive_windows.h new file mode 100644 index 000000000..2be0487db --- /dev/null +++ b/libarchive/archive_windows.h @@ -0,0 +1,160 @@ +/*- + * Copyright (c) 2003-2006 Tim Kientzle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef LIBARCHIVE_NONPOSIX_H_INCLUDED +#define LIBARCHIVE_NONPOSIX_H_INCLUDED + +/* Start of configuration for native Win32 */ + +#include +#define set_errno(val) ((errno)=val) +#include +#include +#include +#include +#include + +#define EFTYPE 7 +#define STDIN_FILENO 0 +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 + +/* TODO: Fix the code, don't suppress the warnings. */ +#pragma warning(disable:4244) /* 'conversion' conversion from 'type1' to 'type2', possible loss of data */ +#pragma warning(disable:4146) /* unary minus operator applied to unsigned type, result still unsigned */ +#pragma warning(disable:4996) /* 'function': was declared deprecated */ +#pragma warning(disable:4267) /* Conversion, possible loss of data */ + +/* Basic definitions for system and integer types. */ +#ifndef _SSIZE_T_ +# define SSIZE_MAX LONG_MAX +#define _SSIZE_T_ +#endif /* _SSIZE_T_ */ + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +/* Replacement for major/minor/makedev. */ +#define major(x) ((int)(0x00ff & ((x) >> 8))) +#define minor(x) ((int)(0xffff00ff & (x))) +#define makedev(maj,min) ((0xff00 & ((maj)<<8))|(0xffff00ff & (min))) + +#define EFTYPE 7 +#ifndef STDERR_FILENO +#define STDERR_FILENO 2 +#endif /* STDERR_FILENO */ + +/* Alias the Windows _function to the POSIX equivalent. */ +#define chdir _chdir +#define chmod _chmod +#define close _close +#define dup _dup +#define dup2 _dup2 +#define execlp _execlp +#define fileno _fileno +#define fstat _fstat +#define lseek _lseek +#define lstat _stat +#define open _open +#define stat _stat +#define mkdir(d,m) _mkdir(d) +#define mktemp _mktemp +#define read _read +#define rmdir _rmdir +#define strdup _strdup +#define stricmp _stricmp +#define tzset _tzset +#define umask _umask +#define write _write + +#define O_RDONLY _O_RDONLY +#define O_WRONLY _O_WRONLY +#define O_TRUNC _O_TRUNC +#define O_CREAT _O_CREAT +#define O_EXCL _O_EXCL + +#define S_ISUID 0004000 +#define S_ISGID 0002000 +#define S_ISVTX 0001000 + +#define S_IFMT 0170000 +#define S_IFDIR _S_IFDIR +#define S_IFREG _S_IFREG + +#define S_ISDIR(m) (((m) & 0170000) == _S_IFDIR) /* directory */ +#define S_ISCHR(m) (((m) & 0170000) == _S_IFCHR) /* char special */ +#define S_ISREG(m) (((m) & 0170000) == _S_IFREG) /* regular file */ + +/* Windows doesn't have the following, so they're trivial. */ +#define S_ISBLK(m) (0) /* block special */ +#define S_ISFIFO(m) (0) /* fifo or socket */ +#define S_ISLNK(m) (0) /* Symbolic link */ +#define S_ISSOCK(m) (0) /* Socket */ + +/* replace stat and seek by their large-file equivalents */ +#undef stat +#define stat _stati64 +#undef lstat +#define lstat _stati64 +#undef fstat +#define fstat _fstati64 + +#undef lseek +#define lseek _lseeki64 +#define lseek64 _lseeki64 +#define tell _telli64 +#define tell64 _telli64 + +#ifdef __MINGW32__ +# define fseek fseeko64 +# define fseeko fseeko64 +# define ftell ftello64 +# define ftello ftello64 +# define ftell64 ftello64 +#endif /* __MINGW32__ */ + +/* End of Win32 definitions. */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int link (const char *from, const char *to); +extern int symlink (const char *from, const char *to); +extern int fcntl (int fd, int cmd, ...); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBARCHIVE_NONPOSIX_H_INCLUDED */ diff --git a/libarchive/archive_write_set_compression_program.c b/libarchive/archive_write_set_compression_program.c index fc1481dbc..b8b20c86c 100644 --- a/libarchive/archive_write_set_compression_program.c +++ b/libarchive/archive_write_set_compression_program.c @@ -27,6 +27,23 @@ __FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_compression_program.c,v 1.1 2007/05/29 01:00:19 kientzle Exp $"); +/* This capability is only available on POSIX systems. */ +#if !defined(HAVE_PIPE) || !defined(HAVE_VFORK) || !defined(HAVE_FCNTL) + +/* + * On non-Posix systems, allow the program to build, but choke if + * this function is actually invoked. + */ +int +archive_write_set_compression_program(struct archive *_a, const char *cmd) +{ + archive_set_error(_a, -1, + "External compression programs not supported on this platform"); + return (ARCHIVE_FATAL); +} + +#else + #ifdef HAVE_SYS_WAIT_H # include #endif @@ -320,3 +337,5 @@ cleanup: free(state); return (ret); } + +#endif /* !defined(HAVE_PIPE) || !defined(HAVE_VFORK) || !defined(HAVE_FCNTL) */ diff --git a/libarchive/config_freebsd.h b/libarchive/config_freebsd.h index 97127a19b..3d5e82161 100644 --- a/libarchive/config_freebsd.h +++ b/libarchive/config_freebsd.h @@ -51,6 +51,7 @@ #define HAVE_FCHFLAGS 1 #define HAVE_FCHMOD 1 #define HAVE_FCHOWN 1 +#define HAVE_FCNTL 1 #define HAVE_FCNTL_H 1 #define HAVE_FSEEKO 1 #define HAVE_FSTAT 1 @@ -70,6 +71,7 @@ #define HAVE_MKDIR 1 #define HAVE_MKFIFO 1 #define HAVE_MKNOD 1 +#define HAVE_PIPE 1 #define HAVE_POLL 1 #define HAVE_POLL_H 1 #define HAVE_PWD_H 1 @@ -102,6 +104,7 @@ #define HAVE_UTIME 1 #define HAVE_UTIMES 1 #define HAVE_UTIME_H 1 +#define HAVE_VFORK 1 #define HAVE_WCHAR_H 1 #define HAVE_WCSCPY 1 #define HAVE_WCSLEN 1 diff --git a/libarchive/config_windows.h b/libarchive/config_windows.h new file mode 100644 index 000000000..0c577d8a6 --- /dev/null +++ b/libarchive/config_windows.h @@ -0,0 +1,688 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ +#ifndef CONFIG_H_INCLUDED +#define CONFIG_H_INCLUDED + + +/////////////////////////////////////////////////////////////////////////// +// Check for Watcom and Microsoft Visual C compilers (WIN32 only) /////// +/////////////////////////////////////////////////////////////////////////// +#if defined(__WIN32__) || defined(_WIN32) || defined(__WIN32) + #define IS_WIN32 1 + + #if defined(__TURBOC__) || defined(__BORLANDC__) /* Borland compilers */ + #elif defined( __WATCOMC__ ) || defined(__WATCOMCPP__) /* Watcom compilers */ + #define IS_WATCOM 1 + /* Define to 1 if __INT64 is defined */ + #define HAVE___INT64 1 + + /* Define to 1 if UID should be unsigned */ + #define USE_UNSIGNED_UID 1 + + /* Define to 1 if UID should be unsigned */ + #define USE_UNSIGNED_GID 1 + + #elif defined(__IBMC__) || defined(__IBMCPP__) /* IBM compilers */ + #elif defined( __SC__ ) /* Symantec C++ compilers */ + #elif defined( M_I86 ) && defined( MSDOS ) /* Microsoft DOS/Win 16 compilers */ + #elif defined( _M_IX86 ) || defined( _68K_ ) /* Microsoft Win32 compilers */ + #define IS_VISUALC 1 + /* Define to 1 if __INT64 is defined */ + #define HAVE___INT64 1 + #else + #endif + +#endif +/////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////// + +/* Define to 1 if you have the `acl_create_entry' function. */ +/* #undef HAVE_ACL_CREATE_ENTRY */ + +/* Define to 1 if you have the `acl_get_perm' function. */ +/* #undef HAVE_ACL_GET_PERM */ + +/* Define to 1 if you have the `acl_get_perm_np' function. */ +/* #undef HAVE_ACL_GET_PERM_NP */ + +/* Define to 1 if you have the `acl_init' function. */ +/* #undef HAVE_ACL_INIT */ + +/* Define to 1 if the system has the type `acl_permset_t'. */ +/* #undef HAVE_ACL_PERMSET_T */ + +/* Define to 1 if you have the `acl_set_fd' function. */ +/* #undef HAVE_ACL_SET_FD */ + +/* Define to 1 if you have the `acl_set_fd_np' function. */ +/* #undef HAVE_ACL_SET_FD_NP */ + +/* Define to 1 if you have the `acl_set_file' function. */ +/* #undef HAVE_ACL_SET_FILE */ + +/* True for systems with POSIX ACL support */ +/* #undef HAVE_ACL_USER */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ATTR_XATTR_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BZLIB_H */ + +/* Define to 1 if you have the `chflags' function. */ +/* #undef HAVE_CHFLAGS */ + +/* Define to 1 if you have the `chown' function. */ +/* #undef HAVE_CHOWN */ + +/* Define to 1 if you have the declaration of `INT64_MAX', and to 0 if you + don't. */ +/* #undef HAVE_DECL_INT64_MAX */ + +/* Define to 1 if you have the declaration of `INT64_MIN', and to 0 if you + don't. */ +/* #undef HAVE_DECL_INT64_MIN */ + +/* Define to 1 if you have the declaration of `optarg', and to 0 if you don't. + */ +/* #undef HAVE_DECL_OPTARG */ + +/* Define to 1 if you have the declaration of `optind', and to 0 if you don't. + */ +/* #undef HAVE_DECL_OPTIND */ + +/* Define to 1 if you have the declaration of `SIZE_MAX', and to 0 if you + don't. */ +/* #undef HAVE_DECL_SIZE_MAX */ + +#if defined(_MSC_VER) && _MSC_VER >= 1400 +#define HAVE_DECL_SIZE_MAX 1 +#endif + +/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you + don't. */ +/* #undef HAVE_DECL_STRERROR_R */ + +/* Define to 1 if you have the declaration of `UINT32_MAX', and to 0 if you + don't. */ +/* #undef HAVE_DECL_UINT32_MAX */ + +/* Define to 1 if you have the declaration of `UINT64_MAX', and to 0 if you + don't. */ +/* #undef HAVE_DECL_UINT64_MAX */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_DIRENT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DLFCN_H */ + +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +/* #undef HAVE_DOPRNT */ + +/* Define to 1 if nl_langinfo supports D_MD_ORDER */ +/* #undef HAVE_D_MD_ORDER */ + +/* A possible errno value for invalid file format errors */ +#if ((IS_WATCOM) || (IS_VISUALC)) +#define HAVE_EFTYPE 0 +#else +#define HAVE_EFTYPE 1 +#endif + +/* A possible errno value for invalid file format errors */ +#define HAVE_EILSEQ 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_EXT2FS_EXT2_FS_H */ + +/* Define to 1 if you have the `fchdir' function. */ +/* #undef HAVE_FCHDIR */ + +/* Define to 1 if you have the `fchflags' function. */ +/* #undef HAVE_FCHFLAGS */ + +/* Define to 1 if you have the `fchmod' function. */ +/* #undef HAVE_FCHMOD */ + +/* Define to 1 if you have the `fchown' function. */ +/* #undef HAVE_FCHOWN */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_FCNTL_H 1 */ + +/* Define to 1 if you have the fcntl() function. */ +/* #undef HAVE_FCNTL_FN */ + +/* Define to 1 if your system has a working POSIX `fnmatch' function. */ +/* #undef HAVE_FNMATCH */ + +/* Define to 1 if fnmatch(3) supports the FNM_LEADING_DIR flag */ +/* #undef HAVE_FNM_LEADING_DIR */ + +/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ +/* #undef HAVE_FSEEKO */ + +/* Define to 1 if you have the `fsetxattr' function. */ +/* #undef HAVE_FSETXATTR */ + +/* Define to 1 if you have the `ftruncate' function. */ +/* #undef HAVE_FTRUNCATE */ + +/* Define to 1 if you have the `futimes' function. */ +/* #undef HAVE_FUTIMES */ + +/* Define to 1 if you have the `geteuid' function. */ +/* #undef HAVE_GETEUID */ + +/* Define to 1 if you have the `getopt_long' function. */ +/* #undef HAVE_GETOPT_LONG */ + +/* Define to 1 if you have the `getxattr' function. */ +/* #undef HAVE_GETXATTR */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GRP_H */ + +/* Define to 1 if the system has the type `intmax_t'. */ +/* #undef HAVE_INTMAX_T */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_INTTYPES_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LANGINFO_H */ + +/* Define to 1 if you have the `lchflags' function. */ +/* #undef HAVE_LCHFLAGS */ + +/* Define to 1 if you have the `lchmod' function. */ +/* #undef HAVE_LCHMOD */ + +/* Define to 1 if you have the `lchown' function. */ +/* #undef HAVE_LCHOWN */ + +/* Define to 1 if you have the `lgetxattr' function. */ +/* #undef HAVE_LGETXATTR */ + +/* Define to 1 if you have the `acl' library (-lacl). */ +/* #undef HAVE_LIBACL */ + +/* Define to 1 if you have the `attr' library (-lattr). */ +/* #undef HAVE_LIBATTR */ + +/* Define to 1 if you have the `bz2' library (-lbz2). */ +/* #undef HAVE_LIBBZ2 */ + +/* Define to 1 if you have the `z' library (-lz). */ +/* #undef HAVE_LIBZ */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_EXT2_FS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_FS_H */ + +/* Define to 1 if you have the `listxattr' function. */ +/* #undef HAVE_LISTXATTR */ + +/* Define to 1 if you have the `llistxattr' function. */ +/* #undef HAVE_LLISTXATTR */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if the system has the type `long long int'. */ +#define HAVE_LONG_LONG_INT 1 + +/* Define to 1 if you have the `lsetxattr' function. */ +/* #undef HAVE_LSETXATTR */ + +/* Define to 1 if `lstat' has the bug that it succeeds when given the + zero-length file name argument. */ +/* #undef HAVE_LSTAT_EMPTY_STRING_BUG */ + +/* Define to 1 if you have the `lutimes' function. */ +/* #undef HAVE_LUTIMES */ + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `memset' function. */ +#define HAVE_MEMSET 1 + +/* Define to 1 if you have the `mkdir' function. */ +#define HAVE_MKDIR 1 + +/* Define to 1 if you have the `mkfifo' function. */ +/* #undef HAVE_MKFIFO */ + +/* Define to 1 if you have the `mknod' function. */ +/* #undef HAVE_MKNOD */ + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +/* #undef HAVE_NDIR_H */ + +/* Define to 1 if you have the `nl_langinfo' function. */ +/* #undef HAVE_NL_LANGINFO */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PATHS_H */ + +/* Define to 1 if you have the `poll' function. */ +/* #undef HAVE_POLL */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_POLL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PWD_H */ + +/* Define to 1 if you have the `select' function. */ +/* #undef HAVE_SELECT */ + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if `stat' has the bug that it succeeds when given the + zero-length file name argument. */ +/* #undef HAVE_STAT_EMPTY_STRING_BUG */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDARG_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STDINT_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strchr' function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the `strerror_r' function. */ +/* #undef HAVE_STRERROR_R */ + +/* Define to 1 if you have the `strftime' function. */ +#define HAVE_STRFTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strrchr' function. */ +#define HAVE_STRRCHR 1 + +/* Define to 1 if `st_mtimespec.tv_nsec' is member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC */ + +/* Define to 1 if `st_mtim.tv_nsec' is member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC */ + +/* Define to 1 if `st_rdev' is member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_RDEV 1 + +/* Define to 1 if `tm_gmtoff' is member of `struct tm'. */ +/* #undef HAVE_STRUCT_TM_TM_GMTOFF */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_ACL_H */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_IOCTL_H */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_PARAM_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_POLL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SELECT_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_TIME_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UTIME_H 1 + +/* Define to 1 if you have that is POSIX.1 compatible. */ +/* #undef HAVE_SYS_WAIT_H */ + +/* Define to 1 if you have the `timegm' function. */ +/* #undef HAVE_TIMEGM */ + +/* Define to 1 if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define to 1 if the system has the type `uintmax_t'. */ +/* #undef HAVE_UINTMAX_T */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_UNISTD_H */ + +/* Define to 1 if the system has the type `unsigned long long'. */ +#define HAVE_UNSIGNED_LONG_LONG 1 + +/* Define to 1 if the system has the type `unsigned long long int'. */ +#define HAVE_UNSIGNED_LONG_LONG_INT 1 + +/* Define to 1 if you have the `utime' function. */ +#define HAVE_UTIME 1 + +/* Define to 1 if you have the `utimes' function. */ +/* #undef HAVE_UTIMES */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_UTIME_H */ + +/* Define to 1 if you have the `vprintf' function. */ +#define HAVE_VPRINTF 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WCHAR_H 1 + +/* Define to 1 if you have the `wcscpy' function. */ +#define HAVE_WCSCPY 1 + +/* Define to 1 if you have the `wcslen' function. */ +#define HAVE_WCSLEN 1 + +/* Define to 1 if you have the `wmemcmp' function. */ +/* #undef HAVE_WMEMCMP */ + +/* Define to 1 if you have the `wmemcpy' function. */ +/* #undef HAVE_WMEMCPY */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ZLIB_H 1 + +/* Version number of libarchive as a single integer */ +#define LIBARCHIVE_VERSION_NUMBER "2005000" + +/* Version number of libarchive */ +#define LIBARCHIVE_VERSION_STRING "2.5.0b" + +/* Define to 1 if `lstat' dereferences a symlink specified with a trailing + slash. */ +/* #undef LSTAT_FOLLOWS_SLASHED_SYMLINK */ + +/* Define to 1 if `major', `minor', and `makedev' are declared in . + */ +/* #undef MAJOR_IN_MKDEV */ + +/* Define to 1 if `major', `minor', and `makedev' are declared in + . */ +/* #undef MAJOR_IN_SYSMACROS */ + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef NO_MINUS_C_MINUS_O */ + +/* Name of package */ +#define PACKAGE "libarchive" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "kientzle@freebsd.org" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libarchive" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libarchive 2.4.12" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libarchive" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "2.4.12" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if strerror_r returns char *. */ +/* #undef STRERROR_R_CHAR_P */ + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Version number of package */ +#define VERSION "2.4.12" + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ +/* #undef _LARGEFILE_SOURCE */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define for Solaris 2.5.1 so the uint64_t typedef from , + , or is not used. If the typedef was allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT64_T */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `int' if doesn't define. */ +#if (USE_UNSIGNED_GID) +#define gid_t unsigned int +#else +#define gid_t int +#endif + +/* Define to `unsigned long' if does not define. */ +#define id_t int + +/* Define to the type of a signed integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +#if (HAVE___INT64) +typedef __int64 int64_t; +#else +#define int64_t long long +#endif + +/* Define to the widest signed integer type if and do + not define. */ +#if (HAVE___INT64) +typedef __int64 intmax_t; +#else +#define intmax_t long long +#endif + +/* Define to `int' if does not define. */ +#define mode_t unsigned short + +/* Define to `long long' if does not define. */ +/* #undef off_t */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +/* Define to `int' if doesn't define. */ +#if (USE_UNSIGNED_UID) +#define uid_t unsigned int +#else +#define uid_t int +#endif + +/* Define to the type of an unsigned integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +#if (HAVE___INT64) +typedef unsigned __int64 uint64_t; +#else +#define uint64_t unsigned long long +#endif + +/* Define to the widest unsigned integer type if and + do not define. */ +#if (HAVE___INT64) +typedef unsigned __int64 uintmax_t; +#else +#define uintmax_t unsigned long long +#endif + +/* Define to `unsigned int' if does not define. */ +/* #undef uintptr_t */ + +/* Define to `unsigned int' if does not define. */ +#define pid_t unsigned int + +#define uint32_t unsigned long +#define uint16_t unsigned short +#define ssize_t long + + +/////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +#if (IS_VISUALC) + #include + #include //brings in NULL + #include //brings in S_IFMT(), etc... + + #define HAVE_UINTPTR 0 + + #if !defined(STDIN_FILENO) + #define STDIN_FILENO 0 + #endif + + #if !defined(STDOUT_FILENO) + #define STDOUT_FILENO 1 + #endif + + #if !defined(STDERR_FILENO) + #define STDERR_FILENO 2 + #endif + + /* Define to 1 if ino_t is defined (possibly in sys/types.h) */ + #define HAVE_INO_T 1 + + #define S_IFFIFO _S_IFIFO + + #define S_ISBLK( m ) 0 + #define S_ISFIFO( m ) (((m) & S_IFMT) == S_IFFIFO) + #define S_ISCHR( m ) (((m) & S_IFMT) == S_IFCHR) + #define S_ISDIR( m ) (((m) & S_IFMT) == S_IFDIR) + #define S_ISREG( m ) (((m) & S_IFMT) == S_IFREG) + #define S_ISUID 0004000 + #define S_ISGID 0002000 + #define S_ISVTX 0001000 + + //NOT SURE IF O_NONBLOCK is OK here but at least the 0x0004 flag is not used by anything else... + #define O_NONBLOCK 0x0004 /* Non-blocking I/O. */ + //#define O_NDELAY O_NONBLOCK + + #define lstat _stat + + /* Symbolic constants for the access() function */ + #if !defined(F_OK) + #define R_OK 4 /* Test for read permission */ + #define W_OK 2 /* Test for write permission */ + #define X_OK 1 /* Test for execute permission */ + #define F_OK 0 /* Test for existence of file */ + #endif + +#endif + +////////////////////////////////////////////////////////////////////////// +#if (IS_WATCOM) + #include //brings in STDERR/OUT/IN_FILENO, dup(), dup2(), close(), write(), etc... + #include //brings in execlp() and _exit() + #include //brings in NULL + #include + + /* Define to 1 if ino_t is defined (possibly in sys/types.h) */ + #define HAVE_INO_T 1 + + //NOT SURE IF O_NONBLOCK is OK here but at least the 0x0004 flag is not used by anything else... + #define O_NONBLOCK 0x0004 /* Non-blocking I/O. */ + //#define O_NDELAY O_NONBLOCK + + //Prototypes for functions which we'll define in archive_windows.c + extern unsigned int sleep (unsigned int seconds); + + #define lstat _stat +#endif + + +////////////////////////////////////////////////////////////////////////// +#if !(HAVE_UINTPTR) + typedef unsigned int *uintptr_t; + #if defined(HAVE_UINTPTR) + #undef HAVE_UINTPTR + #endif + #define HAVE_UINTPTR 1 +#endif + +#if !defined(SSIZE_MAX) + //#define _POSIX_SSIZE_MAX 32767 + #if defined(_POSIX_SSIZE_MAX) + #define SSIZE_MAX _POSIX_SSIZE_MAX + #else + #define SSIZE_MAX ((ssize_t)((size_t)-1 >> 1)) + #endif +#endif + +#if !(HAVE_FCNTL_FN) + #define F_SETFL 4 /* Set file status flags. */ + + #if defined(HAVE_FCNTL_FN) + #undef HAVE_FCNTL_FN + #endif + #define HAVE_FCNTL_FN 1 +#endif + + #define _S_IFLNK 0xA000 /* symbolic link */ + #if !defined(_S_IFMT) + #define _S_IFMT S_IFMT + #endif + + #define _S_ISLNK(m) (((m) & _S_IFMT) == _S_IFLNK) + #define S_ISLNK(m) _S_ISLNK(m) + + +/* Replacement for major/minor/makedev. */ +#if !(MAJOR_IN_MKDEV) && !(MAJOR_IN_SYSMACROS) + #define major(x) ((int)(0x00ff & ((x) >> 8))) + #define minor(x) ((int)(0xffff00ff & (x))) + #define makedev(maj,min) ((0xff00 & ((maj)<<8))|(0xffff00ff & (min))) +#endif + +#define set_errno(val) ((errno)=val) + + +#endif /* CONFIG_H_INCLUDED */ diff --git a/libarchive/filter_fork.c b/libarchive/filter_fork.c index 8cad9e2f0..3c2d829d0 100644 --- a/libarchive/filter_fork.c +++ b/libarchive/filter_fork.c @@ -25,6 +25,9 @@ #include "archive_platform.h" +/* This capability is only available on POSIX systems. */ +#if defined(HAVE_PIPE) && defined(HAVE_VFORK) && defined(HAVE_FCNTL) + __FBSDID("$FreeBSD: src/lib/libarchive/filter_fork.c,v 1.2 2007/12/30 04:58:22 kientzle Exp $"); #if defined(HAVE_POLL) @@ -137,3 +140,5 @@ __archive_check_child(int in, int out) sleep(1); #endif } + +#endif /* defined(HAVE_PIPE) && defined(HAVE_VFORK) && defined(HAVE_FCNTL) */