libarchive 3.0.2-r4051 (reduced)
Extract upstream libarchive using the following shell code. url=https://libarchive.googlecode.com/svn/release/3.0 v=3.0.2 r=4051 paths=" CMakeLists.txt COPYING CTestConfig.cmake build/cmake build/pkgconfig build/utils build/version libarchive/*.* " date=$(svn log -q -c$r $url | sed -n "/^r/ {s/[^|]*|[^|]*|//;p;}") svn export -r$r $url libarchive-$v-r$r && mkdir libarchive-$v-r$r-reduced && (cd libarchive-$v-r$r && tar c $paths) | (cd libarchive-$v-r$r-reduced && tar x) echo "r$r date: $date"
This commit is contained in:
parent
2f4a3792bb
commit
4f4fe6e50b
|
@ -2,12 +2,12 @@
|
||||||
#
|
#
|
||||||
PROJECT(libarchive C)
|
PROJECT(libarchive C)
|
||||||
#
|
#
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3 FATAL_ERROR)
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
|
||||||
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake")
|
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake")
|
||||||
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
|
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${libarchive_BINARY_DIR}/bin)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${libarchive_BINARY_DIR}/bin)
|
||||||
endif()
|
endif()
|
||||||
SET(CMAKE_BUILD_TYPE "Debug")
|
SET(CMAKE_BUILD_TYPE "Release")
|
||||||
|
|
||||||
# On MacOS, prefer MacPorts libraries to system libraries.
|
# On MacOS, prefer MacPorts libraries to system libraries.
|
||||||
# I haven't come up with a compelling argument for this to be conditional.
|
# I haven't come up with a compelling argument for this to be conditional.
|
||||||
|
@ -38,9 +38,10 @@ SET(LIBARCHIVE_VERSION_STRING "${VERSION}")
|
||||||
# INTERFACE_VERSION increments with every release
|
# INTERFACE_VERSION increments with every release
|
||||||
# libarchive 2.7 == interface version 9 = 2 + 7
|
# libarchive 2.7 == interface version 9 = 2 + 7
|
||||||
# libarchive 2.8 == interface version 10 = 2 + 8
|
# libarchive 2.8 == interface version 10 = 2 + 8
|
||||||
# libarchive 3.0 == interface version 11
|
# libarchive 2.9 == interface version 11 = 2 + 9
|
||||||
# libarchive 3.x == interface version 11 + x
|
# libarchive 3.0 == interface version 12
|
||||||
math(EXPR INTERFACE_VERSION "11 + ${_minor}")
|
# libarchive 3.x == interface version 12 + x
|
||||||
|
math(EXPR INTERFACE_VERSION "12 + ${_minor}")
|
||||||
|
|
||||||
# Set SOVERSION == Interface version
|
# Set SOVERSION == Interface version
|
||||||
# ?? Should there be more here ??
|
# ?? Should there be more here ??
|
||||||
|
@ -50,17 +51,13 @@ SET(SOVERSION "${INTERFACE_VERSION}")
|
||||||
# aggressive about diagnosing build problems; this can get
|
# aggressive about diagnosing build problems; this can get
|
||||||
# relaxed somewhat in final shipping versions.
|
# relaxed somewhat in final shipping versions.
|
||||||
IF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$")
|
IF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$")
|
||||||
ADD_DEFINITIONS(-Wall -Werror)
|
ADD_DEFINITIONS(-Wall)
|
||||||
SET(CMAKE_REQUIRED_FLAGS "-Wall -Werror")
|
SET(CMAKE_REQUIRED_FLAGS "-Wall")
|
||||||
ENDIF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$")
|
ENDIF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$")
|
||||||
|
|
||||||
# Enable CTest/CDash support
|
# Enable CTest/CDash support
|
||||||
include(CTest)
|
include(CTest)
|
||||||
|
|
||||||
# Provide ADD_TEST_28 macro to approximate CMake 2.8 ADD_TEST(NAME).
|
|
||||||
# TODO: Require CMake 2.8 and drop this workaround (perhaps late 2010).
|
|
||||||
INCLUDE(AddTest28)
|
|
||||||
|
|
||||||
OPTION(ENABLE_NETTLE "Enable use of Nettle" ON)
|
OPTION(ENABLE_NETTLE "Enable use of Nettle" ON)
|
||||||
OPTION(ENABLE_OPENSSL "Enable use of OpenSSL" ON)
|
OPTION(ENABLE_OPENSSL "Enable use of OpenSSL" ON)
|
||||||
OPTION(ENABLE_TAR "Enable tar building" ON)
|
OPTION(ENABLE_TAR "Enable tar building" ON)
|
||||||
|
|
|
@ -1,107 +0,0 @@
|
||||||
# - Macro approximating the CMake 2.8 ADD_TEST(NAME) signature.
|
|
||||||
# ADD_TEST_28(NAME <name> COMMAND <command> [arg1 [arg2 ...]])
|
|
||||||
# <name> - The name of the test
|
|
||||||
# <command> - The test executable
|
|
||||||
# [argN...] - Arguments to the test executable
|
|
||||||
# This macro approximates the ADD_TEST(NAME) signature provided in
|
|
||||||
# CMake 2.8 but works with CMake 2.6 too. See CMake 2.8 documentation
|
|
||||||
# of ADD_TEST()for details.
|
|
||||||
#
|
|
||||||
# This macro automatically replaces a <command> that names an
|
|
||||||
# executable target with the target location. A generator expression
|
|
||||||
# of the form "$<TARGET_FILE:tgt>" is supported in both the command
|
|
||||||
# and arguments of the test. Howerver, this macro only works for
|
|
||||||
# targets without per-config output name properties set.
|
|
||||||
#
|
|
||||||
# Example usage:
|
|
||||||
# add_test(NAME mytest COMMAND testDriver --exe $<TARGET_FILE:myexe>)
|
|
||||||
# This creates a test "mytest" whose command runs a testDriver tool
|
|
||||||
# passing the full path to the executable file produced by target
|
|
||||||
# "myexe".
|
|
||||||
|
|
||||||
#=============================================================================
|
|
||||||
# Copyright 2009 Kitware, Inc.
|
|
||||||
# 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.
|
|
||||||
#=============================================================================
|
|
||||||
|
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3)
|
|
||||||
|
|
||||||
# CMake 2.8 supports ADD_TEST(NAME) natively.
|
|
||||||
IF(NOT "${CMAKE_VERSION}" VERSION_LESS "2.8")
|
|
||||||
MACRO(ADD_TEST_28)
|
|
||||||
ADD_TEST(${ARGV})
|
|
||||||
ENDMACRO()
|
|
||||||
RETURN()
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
# Simulate ADD_TEST(NAME) signature from CMake 2.8.
|
|
||||||
MACRO(ADD_TEST_28 NAME name COMMAND command)
|
|
||||||
# Enforce the signature.
|
|
||||||
IF(NOT "x${NAME}" STREQUAL "xNAME")
|
|
||||||
MESSAGE(FATAL_ERROR "First ADD_TEST_28 argument must be \"NAME\"")
|
|
||||||
ENDIF()
|
|
||||||
IF(NOT "x${COMMAND}" STREQUAL "xCOMMAND")
|
|
||||||
MESSAGE(FATAL_ERROR "Third ADD_TEST_28 argument must be \"COMMAND\"")
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
# Perform "COMMAND myexe ..." substitution.
|
|
||||||
SET(cmd "${command}")
|
|
||||||
IF(TARGET "${cmd}")
|
|
||||||
_ADD_TEST_28_GET_EXE(${cmd} cmd)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
# Perform "COMMAND ... $<TARGET_FILE:myexe> ..." substitution.
|
|
||||||
SET(target_file "\\$<TARGET_FILE:(.+)>")
|
|
||||||
SET(args)
|
|
||||||
FOREACH(ARG ${cmd} ${ARGN})
|
|
||||||
SET(arg "${ARG}")
|
|
||||||
IF("${arg}" MATCHES "${target_file}")
|
|
||||||
STRING(REGEX REPLACE "${target_file}" "\\1" tgt "${arg}")
|
|
||||||
IF(TARGET "${tgt}")
|
|
||||||
_ADD_TEST_28_GET_EXE(${tgt} exe)
|
|
||||||
STRING(REGEX REPLACE "${target_file}" "${exe}" arg "${arg}")
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
|
||||||
LIST(APPEND args "${arg}")
|
|
||||||
ENDFOREACH()
|
|
||||||
|
|
||||||
# Invoke old ADD_TEST() signature with transformed arguments.
|
|
||||||
ADD_TEST(${name} ${args})
|
|
||||||
ENDMACRO()
|
|
||||||
|
|
||||||
# Get the test-time location of an executable target.
|
|
||||||
MACRO(_ADD_TEST_28_GET_EXE tgt exe_var)
|
|
||||||
# The LOCATION property gives a build-time location.
|
|
||||||
GET_TARGET_PROPERTY(${exe_var} ${tgt} LOCATION)
|
|
||||||
|
|
||||||
# In single-configuration generatrs the build-time and test-time
|
|
||||||
# locations are the same because there is no per-config variable
|
|
||||||
# reference. In multi-configuration generators the following
|
|
||||||
# substitution converts the build-time configuration variable
|
|
||||||
# reference to a test-time configuration variable reference.
|
|
||||||
IF(CMAKE_CONFIGURATION_TYPES)
|
|
||||||
STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CTEST_CONFIGURATION_TYPE}"
|
|
||||||
${exe_var} "${${exe_var}}")
|
|
||||||
ENDIF(CMAKE_CONFIGURATION_TYPES)
|
|
||||||
ENDMACRO()
|
|
|
@ -1 +1 @@
|
||||||
3000001b
|
3000002
|
||||||
|
|
|
@ -124,27 +124,16 @@ extern "C" {
|
||||||
* easy to compare versions at build time: for version a.b.c, the
|
* easy to compare versions at build time: for version a.b.c, the
|
||||||
* version number is printf("%d%03d%03d",a,b,c). For example, if you
|
* version number is printf("%d%03d%03d",a,b,c). For example, if you
|
||||||
* know your application requires version 2.12.108 or later, you can
|
* know your application requires version 2.12.108 or later, you can
|
||||||
* assert that ARCHIVE_VERSION >= 2012108.
|
* assert that ARCHIVE_VERSION_NUMBER >= 2012108.
|
||||||
*
|
|
||||||
* This single-number format was introduced with libarchive 1.9.0 in
|
|
||||||
* the libarchive 1.x family and libarchive 2.2.4 in the libarchive
|
|
||||||
* 2.x family. The following may be useful if you really want to do
|
|
||||||
* feature detection for earlier libarchive versions (which defined
|
|
||||||
* ARCHIVE_API_VERSION and ARCHIVE_API_FEATURE instead):
|
|
||||||
*
|
|
||||||
* #ifndef ARCHIVE_VERSION_NUMBER
|
|
||||||
* #define ARCHIVE_VERSION_NUMBER \
|
|
||||||
* (ARCHIVE_API_VERSION * 1000000 + ARCHIVE_API_FEATURE * 1000)
|
|
||||||
* #endif
|
|
||||||
*/
|
*/
|
||||||
/* Note: Compiler will complain if this does not match archive_entry.h! */
|
/* Note: Compiler will complain if this does not match archive_entry.h! */
|
||||||
#define ARCHIVE_VERSION_NUMBER 3000001
|
#define ARCHIVE_VERSION_NUMBER 3000002
|
||||||
__LA_DECL int archive_version_number(void);
|
__LA_DECL int archive_version_number(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Textual name/version of the library, useful for version displays.
|
* Textual name/version of the library, useful for version displays.
|
||||||
*/
|
*/
|
||||||
#define ARCHIVE_VERSION_STRING "libarchive 3.0.1b"
|
#define ARCHIVE_VERSION_STRING "libarchive 3.0.2"
|
||||||
__LA_DECL const char * archive_version_string(void);
|
__LA_DECL const char * archive_version_string(void);
|
||||||
|
|
||||||
/* Declare our basic types. */
|
/* Declare our basic types. */
|
||||||
|
@ -447,8 +436,6 @@ __LA_DECL int archive_read_data_block(struct archive *a,
|
||||||
* 'into_fd': writes data to specified filedes
|
* 'into_fd': writes data to specified filedes
|
||||||
*/
|
*/
|
||||||
__LA_DECL int archive_read_data_skip(struct archive *);
|
__LA_DECL int archive_read_data_skip(struct archive *);
|
||||||
__LA_DECL int archive_read_data_into_buffer(struct archive *,
|
|
||||||
void *buffer, __LA_SSIZE_T len);
|
|
||||||
__LA_DECL int archive_read_data_into_fd(struct archive *, int fd);
|
__LA_DECL int archive_read_data_into_fd(struct archive *, int fd);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
.\" $FreeBSD: src/lib/libarchive/archive_entry.3,v 1.18 2008/05/26 17:00:22 kientzle Exp $
|
.\" $FreeBSD: src/lib/libarchive/archive_entry.3,v 1.18 2008/05/26 17:00:22 kientzle Exp $
|
||||||
.\"
|
.\"
|
||||||
.Dd Feburary 22, 2010
|
.Dd Feburary 22, 2010
|
||||||
.Dt archive_entry 3
|
.Dt ARCHIVE_ENTRY 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_entry_clear ,
|
.Nm archive_entry_clear ,
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#define ARCHIVE_ENTRY_H_INCLUDED
|
#define ARCHIVE_ENTRY_H_INCLUDED
|
||||||
|
|
||||||
/* Note: Compiler will complain if this does not match archive.h! */
|
/* Note: Compiler will complain if this does not match archive.h! */
|
||||||
#define ARCHIVE_VERSION_NUMBER 3000001
|
#define ARCHIVE_VERSION_NUMBER 3000002
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note: archive_entry.h is for use outside of libarchive; the
|
* Note: archive_entry.h is for use outside of libarchive; the
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd February 21, 2010
|
.Dd February 21, 2010
|
||||||
.Dt archive_entry_acl 3
|
.Dt ARCHIVE_ENTRY_ACL 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_entry_acl_add_entry ,
|
.Nm archive_entry_acl_add_entry ,
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd February 20, 2010
|
.Dd February 20, 2010
|
||||||
.Dt archive_entry_linkify 3
|
.Dt ARCHIVE_ENTRY_LINKIFY 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_entry_linkresolver ,
|
.Nm archive_entry_linkresolver ,
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd February 22, 2010
|
.Dd February 22, 2010
|
||||||
.Dt archive_entry_paths 3
|
.Dt ARCHIVE_ENTRY_PATHS 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_entry_hardlink ,
|
.Nm archive_entry_hardlink ,
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd February 22, 2010
|
.Dd February 22, 2010
|
||||||
.Dt archive_entry_perms 3
|
.Dt ARCHIVE_ENTRY_PERMS 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_entry_gid ,
|
.Nm archive_entry_gid ,
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd May 12, 2008
|
.Dd May 12, 2008
|
||||||
.Dt archive_entry 3
|
.Dt ARCHIVE_ENTRY 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_entry_stat ,
|
.Nm archive_entry_stat ,
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
.\" $FreeBSD: src/lib/libarchive/archive_entry.3,v 1.18 2008/05/26 17:00:22 kientzle Exp $
|
.\" $FreeBSD: src/lib/libarchive/archive_entry.3,v 1.18 2008/05/26 17:00:22 kientzle Exp $
|
||||||
.\"
|
.\"
|
||||||
.Dd February 21, 2010
|
.Dd February 21, 2010
|
||||||
.Dt archive_entry_time 3
|
.Dt ARCHIVE_ENTRY_TIME 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_entry_atime ,
|
.Nm archive_entry_atime ,
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD: head/lib/libarchive/archive_read.3 191595 2009-04-27 20:13:13Z kientzle $
|
.\" $FreeBSD: head/lib/libarchive/archive_read.3 191595 2009-04-27 20:13:13Z kientzle $
|
||||||
.\"
|
.\"
|
||||||
.Dd March 23, 2011
|
.Dd March 23, 2011
|
||||||
.Dt archive_read 3
|
.Dt ARCHIVE_READ 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_read
|
.Nm archive_read
|
||||||
|
|
|
@ -668,22 +668,6 @@ archive_read_data(struct archive *_a, void *buff, size_t s)
|
||||||
return (bytes_read);
|
return (bytes_read);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ARCHIVE_API_VERSION < 3
|
|
||||||
/*
|
|
||||||
* Obsolete function provided for compatibility only. Note that the API
|
|
||||||
* of this function doesn't allow the caller to detect if the remaining
|
|
||||||
* data from the archive entry is shorter than the buffer provided, or
|
|
||||||
* even if an error occurred while reading data.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
archive_read_data_into_buffer(struct archive *a, void *d, ssize_t len)
|
|
||||||
{
|
|
||||||
|
|
||||||
archive_read_data(a, d, len);
|
|
||||||
return (ARCHIVE_OK);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Skip over all remaining data in this entry.
|
* Skip over all remaining data in this entry.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -25,15 +25,12 @@
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd March 22, 2011
|
.Dd March 22, 2011
|
||||||
.Dt archive_read_data 3
|
.Dt ARCHIVE_READ_DATA 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_read_data
|
.Nm archive_read_data
|
||||||
.Nm archive_read_data_block ,
|
.Nm archive_read_data_block ,
|
||||||
.Nm archive_read_data_skip ,
|
.Nm archive_read_data_skip ,
|
||||||
.\" #if ARCHIVE_API_VERSION < 3
|
|
||||||
.Nm archive_read_data_into_buffer ,
|
|
||||||
.\" #endif
|
|
||||||
.Nm archive_read_data_into_fd
|
.Nm archive_read_data_into_fd
|
||||||
.Nd functions for reading streaming archives
|
.Nd functions for reading streaming archives
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
|
@ -49,10 +46,6 @@
|
||||||
.Fc
|
.Fc
|
||||||
.Ft int
|
.Ft int
|
||||||
.Fn archive_read_data_skip "struct archive *"
|
.Fn archive_read_data_skip "struct archive *"
|
||||||
.\" #if ARCHIVE_API_VERSION < 3
|
|
||||||
.Ft int
|
|
||||||
.Fn archive_read_data_into_buffer "struct archive *" "void *" "ssize_t len"
|
|
||||||
.\" #endif
|
|
||||||
.Ft int
|
.Ft int
|
||||||
.Fn archive_read_data_into_fd "struct archive *" "int fd"
|
.Fn archive_read_data_into_fd "struct archive *" "int fd"
|
||||||
.\"
|
.\"
|
||||||
|
@ -84,13 +77,6 @@ to skip all of the data for this archive entry.
|
||||||
Note that this function is invoked automatically by
|
Note that this function is invoked automatically by
|
||||||
.Fn archive_read_next_header2
|
.Fn archive_read_next_header2
|
||||||
if the previous entry was not completely consumed.
|
if the previous entry was not completely consumed.
|
||||||
.\" #if ARCHIVE_API_VERSION < 3
|
|
||||||
.It Fn archive_read_data_into_buffer
|
|
||||||
This function is deprecated and will be removed.
|
|
||||||
Use
|
|
||||||
.Fn archive_read_data
|
|
||||||
instead.
|
|
||||||
.\" #endif
|
|
||||||
.It Fn archive_read_data_into_fd
|
.It Fn archive_read_data_into_fd
|
||||||
A convenience function that repeatedly calls
|
A convenience function that repeatedly calls
|
||||||
.Fn archive_read_data_block
|
.Fn archive_read_data_block
|
||||||
|
|
|
@ -45,7 +45,7 @@ __FBSDID("$FreeBSD: src/lib/libarchive/archive_read_data_into_fd.c,v 1.16 2008/0
|
||||||
/*
|
/*
|
||||||
* This implementation minimizes copying of data and is sparse-file aware.
|
* This implementation minimizes copying of data and is sparse-file aware.
|
||||||
*/
|
*/
|
||||||
int
|
static int
|
||||||
pad_to(struct archive *a, int fd, int can_lseek,
|
pad_to(struct archive *a, int fd, int can_lseek,
|
||||||
size_t nulls_size, const char *nulls,
|
size_t nulls_size, const char *nulls,
|
||||||
int64_t target_offset, int64_t actual_offset)
|
int64_t target_offset, int64_t actual_offset)
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD: head/lib/libarchive/archive_read_disk.3 190957 2009-04-12 05:04:02Z kientzle $
|
.\" $FreeBSD: head/lib/libarchive/archive_read_disk.3 190957 2009-04-12 05:04:02Z kientzle $
|
||||||
.\"
|
.\"
|
||||||
.Dd March 10, 2009
|
.Dd March 10, 2009
|
||||||
.Dt archive_read_disk 3
|
.Dt ARCHIVE_READ_DISK 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_read_disk_new ,
|
.Nm archive_read_disk_new ,
|
||||||
|
@ -283,7 +283,7 @@ and first appeared in
|
||||||
The
|
The
|
||||||
.Nm libarchive
|
.Nm libarchive
|
||||||
library was written by
|
library was written by
|
||||||
.An Tim Kientzle Aq kientzle@freebsd.org .
|
.An Tim Kientzle Aq kientzle@FreeBSD.org .
|
||||||
.Sh BUGS
|
.Sh BUGS
|
||||||
The
|
The
|
||||||
.Dq standard
|
.Dq standard
|
||||||
|
|
|
@ -246,7 +246,7 @@ archive_read_disk_entry_from_file(struct archive *_a,
|
||||||
return (r);
|
return (r);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#if defined(__APPLE__) && defined(HAVE_COPYFILE_H)
|
||||||
/*
|
/*
|
||||||
* The Mac OS "copyfile()" API copies the extended metadata for a
|
* The Mac OS "copyfile()" API copies the extended metadata for a
|
||||||
* file into a separate file in AppleDouble format (see RFC 1740).
|
* file into a separate file in AppleDouble format (see RFC 1740).
|
||||||
|
|
|
@ -1321,9 +1321,11 @@ setup_current_filesystem(struct archive_read_disk *a)
|
||||||
t->current_filesystem->synthetic = 0;
|
t->current_filesystem->synthetic = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(MNT_NOATIME)
|
||||||
if (sfs.f_flags & MNT_NOATIME)
|
if (sfs.f_flags & MNT_NOATIME)
|
||||||
t->current_filesystem->noatime = 1;
|
t->current_filesystem->noatime = 1;
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
t->current_filesystem->noatime = 0;
|
t->current_filesystem->noatime = 0;
|
||||||
|
|
||||||
#if defined(HAVE_READDIR_R)
|
#if defined(HAVE_READDIR_R)
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd March 22, 2011
|
.Dd March 22, 2011
|
||||||
.Dt archive_read_extract 3
|
.Dt ARCHIVE_READ_EXTRACT 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_read_extract ,
|
.Nm archive_read_extract ,
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd March 19, 2011
|
.Dd March 19, 2011
|
||||||
.Dt archive_read_filter 3
|
.Dt ARCHIVE_READ_FILTER 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_read_support_filter_all ,
|
.Nm archive_read_support_filter_all ,
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD: head/lib/libarchive/archive_read.3 191595 2009-04-27 20:13:13Z kientzle $
|
.\" $FreeBSD: head/lib/libarchive/archive_read.3 191595 2009-04-27 20:13:13Z kientzle $
|
||||||
.\"
|
.\"
|
||||||
.Dd March 19, 2011
|
.Dd March 19, 2011
|
||||||
.Dt archive_read_format 3
|
.Dt ARCHIVE_READ_FORMAT 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_read_support_format_7zip ,
|
.Nm archive_read_support_format_7zip ,
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD: head/lib/libarchive/archive_read.3 191595 2009-04-27 20:13:13Z kientzle $
|
.\" $FreeBSD: head/lib/libarchive/archive_read.3 191595 2009-04-27 20:13:13Z kientzle $
|
||||||
.\"
|
.\"
|
||||||
.Dd March 20, 2011
|
.Dd March 20, 2011
|
||||||
.Dt archive_read_free 3
|
.Dt ARCHIVE_READ_FREE 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_read_close ,
|
.Nm archive_read_close ,
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd March 22, 2011
|
.Dd March 22, 2011
|
||||||
.Dt archive_read_header 3
|
.Dt ARCHIVE_READ_HEADER 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_read_next_header ,
|
.Nm archive_read_next_header ,
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD: head/lib/libarchive/archive_read.3 191595 2009-04-27 20:13:13Z kientzle $
|
.\" $FreeBSD: head/lib/libarchive/archive_read.3 191595 2009-04-27 20:13:13Z kientzle $
|
||||||
.\"
|
.\"
|
||||||
.Dd March 20, 2011
|
.Dd March 20, 2011
|
||||||
.Dt archive_read_new 3
|
.Dt ARCHIVE_READ_NEW 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_read_new
|
.Nm archive_read_new
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD: head/lib/libarchive/archive_read.3 191595 2009-04-27 20:13:13Z kientzle $
|
.\" $FreeBSD: head/lib/libarchive/archive_read.3 191595 2009-04-27 20:13:13Z kientzle $
|
||||||
.\"
|
.\"
|
||||||
.Dd March 19, 2011
|
.Dd March 19, 2011
|
||||||
.Dt archive_read_open 3
|
.Dt ARCHIVE_READ_OPEN 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_read_open ,
|
.Nm archive_read_open ,
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd April 13, 2009
|
.Dd April 13, 2009
|
||||||
.Dt archive_read_options 3
|
.Dt ARCHIVE_READ_OPTIONS 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_read_set_filter_option ,
|
.Nm archive_read_set_filter_option ,
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1962,7 +1962,7 @@ parse_file_info(struct archive_read *a, struct file_info *parent,
|
||||||
(parent->re || parent->re_descendant))
|
(parent->re || parent->re_descendant))
|
||||||
file->re_descendant = 1;
|
file->re_descendant = 1;
|
||||||
if (file->cl_offset) {
|
if (file->cl_offset) {
|
||||||
struct file_info *p;
|
struct file_info *r;
|
||||||
|
|
||||||
if (parent == NULL || parent->parent == NULL) {
|
if (parent == NULL || parent->parent == NULL) {
|
||||||
archive_set_error(&a->archive,
|
archive_set_error(&a->archive,
|
||||||
|
@ -1990,8 +1990,8 @@ parse_file_info(struct archive_read *a, struct file_info *parent,
|
||||||
* Sanity check: cl_offset does not point at its
|
* Sanity check: cl_offset does not point at its
|
||||||
* the parents or itself.
|
* the parents or itself.
|
||||||
*/
|
*/
|
||||||
for (p = parent; p; p = p->parent) {
|
for (r = parent; r; r = r->parent) {
|
||||||
if (p->offset == file->cl_offset) {
|
if (r->offset == file->cl_offset) {
|
||||||
archive_set_error(&a->archive,
|
archive_set_error(&a->archive,
|
||||||
ARCHIVE_ERRNO_MISC,
|
ARCHIVE_ERRNO_MISC,
|
||||||
"Invalid Rockridge CL");
|
"Invalid Rockridge CL");
|
||||||
|
|
|
@ -112,6 +112,8 @@ struct zip {
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ZIP_LENGTH_AT_END 8
|
#define ZIP_LENGTH_AT_END 8
|
||||||
|
#define ZIP_ENCRYPTED (1<<0)
|
||||||
|
#define ZIP_STRONG_ENCRYPTED (1<<6)
|
||||||
#define ZIP_UTF8_NAME (1<<11)
|
#define ZIP_UTF8_NAME (1<<11)
|
||||||
|
|
||||||
static int archive_read_format_zip_streamable_bid(struct archive_read *, int);
|
static int archive_read_format_zip_streamable_bid(struct archive_read *, int);
|
||||||
|
@ -356,7 +358,32 @@ archive_read_format_zip_seekable_read_header(struct archive_read *a,
|
||||||
typically faster (easier for I/O layer to optimize). */
|
typically faster (easier for I/O layer to optimize). */
|
||||||
__archive_read_seek(a, zip->entry->local_header_offset, SEEK_SET);
|
__archive_read_seek(a, zip->entry->local_header_offset, SEEK_SET);
|
||||||
zip->unconsumed = 0;
|
zip->unconsumed = 0;
|
||||||
return zip_read_local_file_header(a, entry, zip);
|
r = zip_read_local_file_header(a, entry, zip);
|
||||||
|
if (r != ARCHIVE_OK)
|
||||||
|
return r;
|
||||||
|
if ((zip->entry->mode & AE_IFMT) == AE_IFLNK) {
|
||||||
|
const void *p;
|
||||||
|
size_t linkname_length = archive_entry_size(entry);
|
||||||
|
|
||||||
|
archive_entry_set_size(entry, 0);
|
||||||
|
p = __archive_read_ahead(a, linkname_length, NULL);
|
||||||
|
if (p == NULL) {
|
||||||
|
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
|
||||||
|
"Truncated Zip file");
|
||||||
|
return ARCHIVE_FATAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (archive_entry_copy_symlink_l(entry, p, linkname_length,
|
||||||
|
NULL) != 0) {
|
||||||
|
/* NOTE: If the last argument is NULL, this will
|
||||||
|
* fail only by memeory allocation failure. */
|
||||||
|
archive_set_error(&a->archive, ENOMEM,
|
||||||
|
"Can't allocate memory for Symlink");
|
||||||
|
return (ARCHIVE_FATAL);
|
||||||
|
}
|
||||||
|
/* TODO: handle character-set issues? */
|
||||||
|
}
|
||||||
|
return ARCHIVE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -722,6 +749,12 @@ archive_read_format_zip_read_data(struct archive_read *a,
|
||||||
if (AE_IFREG != (zip->entry->mode & AE_IFMT))
|
if (AE_IFREG != (zip->entry->mode & AE_IFMT))
|
||||||
return (ARCHIVE_EOF);
|
return (ARCHIVE_EOF);
|
||||||
|
|
||||||
|
if (zip->entry->flags & (ZIP_ENCRYPTED | ZIP_STRONG_ENCRYPTED)) {
|
||||||
|
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
|
||||||
|
"Encrypted file is unsupported");
|
||||||
|
return (ARCHIVE_FAILED);
|
||||||
|
}
|
||||||
|
|
||||||
__archive_read_consume(a, zip->unconsumed);
|
__archive_read_consume(a, zip->unconsumed);
|
||||||
zip->unconsumed = 0;
|
zip->unconsumed = 0;
|
||||||
|
|
||||||
|
|
|
@ -212,7 +212,7 @@ static struct archive_string *
|
||||||
archive_string_append(struct archive_string *as, const char *p, size_t s)
|
archive_string_append(struct archive_string *as, const char *p, size_t s)
|
||||||
{
|
{
|
||||||
if (archive_string_ensure(as, as->length + s + 1) == NULL)
|
if (archive_string_ensure(as, as->length + s + 1) == NULL)
|
||||||
__archive_errx(1, "Out of memory");
|
return (NULL);
|
||||||
memcpy(as->s + as->length, p, s);
|
memcpy(as->s + as->length, p, s);
|
||||||
as->length += s;
|
as->length += s;
|
||||||
as->s[as->length] = 0;
|
as->s[as->length] = 0;
|
||||||
|
@ -223,7 +223,7 @@ static struct archive_wstring *
|
||||||
archive_wstring_append(struct archive_wstring *as, const wchar_t *p, size_t s)
|
archive_wstring_append(struct archive_wstring *as, const wchar_t *p, size_t s)
|
||||||
{
|
{
|
||||||
if (archive_wstring_ensure(as, as->length + s + 1) == NULL)
|
if (archive_wstring_ensure(as, as->length + s + 1) == NULL)
|
||||||
__archive_errx(1, "Out of memory");
|
return (NULL);
|
||||||
wmemcpy(as->s + as->length, p, s);
|
wmemcpy(as->s + as->length, p, s);
|
||||||
as->length += s;
|
as->length += s;
|
||||||
as->s[as->length] = 0;
|
as->s[as->length] = 0;
|
||||||
|
@ -233,13 +233,15 @@ archive_wstring_append(struct archive_wstring *as, const wchar_t *p, size_t s)
|
||||||
void
|
void
|
||||||
archive_string_concat(struct archive_string *dest, struct archive_string *src)
|
archive_string_concat(struct archive_string *dest, struct archive_string *src)
|
||||||
{
|
{
|
||||||
archive_string_append(dest, src->s, src->length);
|
if (archive_string_append(dest, src->s, src->length) == NULL)
|
||||||
|
__archive_errx(1, "Out of memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
archive_wstring_concat(struct archive_wstring *dest, struct archive_wstring *src)
|
archive_wstring_concat(struct archive_wstring *dest, struct archive_wstring *src)
|
||||||
{
|
{
|
||||||
archive_wstring_append(dest, src->s, src->length);
|
if (archive_wstring_append(dest, src->s, src->length) == NULL)
|
||||||
|
__archive_errx(1, "Out of memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -346,7 +348,9 @@ archive_strncat(struct archive_string *as, const void *_p, size_t n)
|
||||||
pp++;
|
pp++;
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
return (archive_string_append(as, p, s));
|
if ((as = archive_string_append(as, p, s)) == NULL)
|
||||||
|
__archive_errx(1, "Out of memory");
|
||||||
|
return (as);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct archive_wstring *
|
struct archive_wstring *
|
||||||
|
@ -362,7 +366,9 @@ archive_wstrncat(struct archive_wstring *as, const wchar_t *p, size_t n)
|
||||||
pp++;
|
pp++;
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
return (archive_wstring_append(as, p, s));
|
if ((as = archive_wstring_append(as, p, s)) == NULL)
|
||||||
|
__archive_errx(1, "Out of memory");
|
||||||
|
return (as);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct archive_string *
|
struct archive_string *
|
||||||
|
@ -387,13 +393,17 @@ archive_wstrcat(struct archive_wstring *as, const wchar_t *p)
|
||||||
struct archive_string *
|
struct archive_string *
|
||||||
archive_strappend_char(struct archive_string *as, char c)
|
archive_strappend_char(struct archive_string *as, char c)
|
||||||
{
|
{
|
||||||
return (archive_string_append(as, &c, 1));
|
if ((as = archive_string_append(as, &c, 1)) == NULL)
|
||||||
|
__archive_errx(1, "Out of memory");
|
||||||
|
return (as);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct archive_wstring *
|
struct archive_wstring *
|
||||||
archive_wstrappend_wchar(struct archive_wstring *as, wchar_t c)
|
archive_wstrappend_wchar(struct archive_wstring *as, wchar_t c)
|
||||||
{
|
{
|
||||||
return (archive_wstring_append(as, &c, 1));
|
if ((as = archive_wstring_append(as, &c, 1)) == NULL)
|
||||||
|
__archive_errx(1, "Out of memory");
|
||||||
|
return (as);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2080,14 +2090,8 @@ archive_strncat_in_locale(struct archive_string *as, const void *_p, size_t n,
|
||||||
*/
|
*/
|
||||||
if (sc == NULL) {
|
if (sc == NULL) {
|
||||||
length = mbsnbytes(_p, n);
|
length = mbsnbytes(_p, n);
|
||||||
/*
|
if (archive_string_append(as, _p, length) == NULL)
|
||||||
* archive_string_append() will call archive_string_ensure()
|
return (-1);/* No memory */
|
||||||
* but we cannot know if that call is failed or not. so
|
|
||||||
* we call archive_string_ensure() here.
|
|
||||||
*/
|
|
||||||
if (archive_string_ensure(as, as->length + length + 1) == NULL)
|
|
||||||
return (-1);
|
|
||||||
archive_string_append(as, _p, length);
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2338,7 +2342,8 @@ best_effort_strncat_in_locale(struct archive_string *as, const void *_p,
|
||||||
* And then this checks all copied MBS can be WCS if so returns 0.
|
* And then this checks all copied MBS can be WCS if so returns 0.
|
||||||
*/
|
*/
|
||||||
if (sc->same) {
|
if (sc->same) {
|
||||||
archive_string_append(as, _p, length);
|
if (archive_string_append(as, _p, length) == NULL)
|
||||||
|
return (-1);/* No memory */
|
||||||
return (invalid_mbs(_p, length, sc));
|
return (invalid_mbs(_p, length, sc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4115,10 +4120,14 @@ archive_mstring_copy_mbs_len_l(struct archive_mstring *aes,
|
||||||
* characters because Windows platform cannot make locale UTF-8.
|
* characters because Windows platform cannot make locale UTF-8.
|
||||||
*/
|
*/
|
||||||
if (sc == NULL) {
|
if (sc == NULL) {
|
||||||
archive_string_append(&(aes->aes_mbs),
|
if (archive_string_append(&(aes->aes_mbs),
|
||||||
mbs, mbsnbytes(mbs, len));
|
mbs, mbsnbytes(mbs, len)) == NULL) {
|
||||||
aes->aes_set = AES_SET_MBS;
|
aes->aes_set = 0;
|
||||||
r = 0;
|
r = -1;
|
||||||
|
} else {
|
||||||
|
aes->aes_set = AES_SET_MBS;
|
||||||
|
r = 0;
|
||||||
|
}
|
||||||
#if defined(HAVE_ICONV)
|
#if defined(HAVE_ICONV)
|
||||||
} else if (sc != NULL && sc->cd_w != (iconv_t)-1) {
|
} else if (sc != NULL && sc->cd_w != (iconv_t)-1) {
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD: head/lib/libarchive/archive_util.3 201098 2009-12-28 02:58:14Z kientzle $
|
.\" $FreeBSD: head/lib/libarchive/archive_util.3 201098 2009-12-28 02:58:14Z kientzle $
|
||||||
.\"
|
.\"
|
||||||
.Dd January 8, 2005
|
.Dd January 8, 2005
|
||||||
.Dt archive_util 3
|
.Dt ARCHIVE_UTIL 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_clear_error ,
|
.Nm archive_clear_error ,
|
||||||
|
|
|
@ -135,6 +135,11 @@ __la_win_permissive_name_w(const wchar_t *wname)
|
||||||
l = GetFullPathNameW(wname, 0, NULL, NULL);
|
l = GetFullPathNameW(wname, 0, NULL, NULL);
|
||||||
if (l == 0)
|
if (l == 0)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
/* NOTE: GetFullPathNameW has a bug that if the length of the file
|
||||||
|
* name is just one that return imcomplete buffer size. Thus, we
|
||||||
|
* have to add three to the size to allocate a sufficient buffer
|
||||||
|
* size for the full-pathname of the file name. */
|
||||||
|
l += 3;
|
||||||
wnp = malloc(l * sizeof(wchar_t));
|
wnp = malloc(l * sizeof(wchar_t));
|
||||||
if (wnp == NULL)
|
if (wnp == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
@ -229,27 +234,6 @@ la_CreateFile(const char *path, DWORD dwDesiredAccess, DWORD dwShareMode,
|
||||||
return (handle);
|
return (handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* This fcntl is limited implementation.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
__la_fcntl(int fd, int cmd, int val)
|
|
||||||
{
|
|
||||||
HANDLE handle;
|
|
||||||
|
|
||||||
handle = (HANDLE)_get_osfhandle(fd);
|
|
||||||
if (GetFileType(handle) == FILE_TYPE_PIPE) {
|
|
||||||
if (cmd == F_SETFL && val == 0) {
|
|
||||||
DWORD mode = PIPE_WAIT;
|
|
||||||
if (SetNamedPipeHandleState(
|
|
||||||
handle, &mode, NULL, NULL) != 0)
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
errno = EINVAL;
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This can exceed MAX_PATH limitation. */
|
/* This can exceed MAX_PATH limitation. */
|
||||||
int
|
int
|
||||||
__la_open(const char *path, int flags, ...)
|
__la_open(const char *path, int flags, ...)
|
||||||
|
@ -368,22 +352,6 @@ __la_read(int fd, void *buf, size_t nbytes)
|
||||||
if (nbytes == 0)
|
if (nbytes == 0)
|
||||||
return (0);
|
return (0);
|
||||||
handle = (HANDLE)_get_osfhandle(fd);
|
handle = (HANDLE)_get_osfhandle(fd);
|
||||||
if (GetFileType(handle) == FILE_TYPE_PIPE) {
|
|
||||||
DWORD sta;
|
|
||||||
if (GetNamedPipeHandleState(
|
|
||||||
handle, &sta, NULL, NULL, NULL, NULL, 0) != 0 &&
|
|
||||||
(sta & PIPE_NOWAIT) == 0) {
|
|
||||||
DWORD avail = -1;
|
|
||||||
int cnt = 3;
|
|
||||||
|
|
||||||
while (PeekNamedPipe(
|
|
||||||
handle, NULL, 0, NULL, &avail, NULL) != 0 &&
|
|
||||||
avail == 0 && --cnt)
|
|
||||||
Sleep(100);
|
|
||||||
if (avail == 0)
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
r = ReadFile(handle, buf, (uint32_t)nbytes,
|
r = ReadFile(handle, buf, (uint32_t)nbytes,
|
||||||
&bytes_read, NULL);
|
&bytes_read, NULL);
|
||||||
if (r == 0) {
|
if (r == 0) {
|
||||||
|
|
|
@ -90,7 +90,7 @@
|
||||||
|
|
||||||
/* Alias the Windows _function to the POSIX equivalent. */
|
/* Alias the Windows _function to the POSIX equivalent. */
|
||||||
#define close _close
|
#define close _close
|
||||||
#define fcntl __la_fcntl
|
#define fcntl(fd, cmd, flg) /* No operation. */
|
||||||
#ifndef fileno
|
#ifndef fileno
|
||||||
#define fileno _fileno
|
#define fileno _fileno
|
||||||
#endif
|
#endif
|
||||||
|
@ -243,7 +243,6 @@
|
||||||
|
|
||||||
|
|
||||||
/* Replacement POSIX function */
|
/* Replacement POSIX function */
|
||||||
extern int __la_fcntl(int fd, int cmd, int val);
|
|
||||||
extern int __la_fstat(int fd, struct stat *st);
|
extern int __la_fstat(int fd, struct stat *st);
|
||||||
extern int __la_lstat(const char *path, struct stat *st);
|
extern int __la_lstat(const char *path, struct stat *st);
|
||||||
extern int __la_open(const char *path, int flags, ...);
|
extern int __la_open(const char *path, int flags, ...);
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD: head/lib/libarchive/archive_write.3 201110 2009-12-28 03:31:29Z kientzle $
|
.\" $FreeBSD: head/lib/libarchive/archive_write.3 201110 2009-12-28 03:31:29Z kientzle $
|
||||||
.\"
|
.\"
|
||||||
.Dd March 23, 2011
|
.Dd March 23, 2011
|
||||||
.Dt archive_write 3
|
.Dt ARCHIVE_WRITE 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_write
|
.Nm archive_write
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd March 23, 2011
|
.Dd March 23, 2011
|
||||||
.Dt archive_write_blocksize 3
|
.Dt ARCHIVE_WRITE_BLOCKSIZE 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_write_get_bytes_per_block ,
|
.Nm archive_write_get_bytes_per_block ,
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD: head/lib/libarchive/archive_write.3 201110 2009-12-28 03:31:29Z kientzle $
|
.\" $FreeBSD: head/lib/libarchive/archive_write.3 201110 2009-12-28 03:31:29Z kientzle $
|
||||||
.\"
|
.\"
|
||||||
.Dd March 23, 2011
|
.Dd March 23, 2011
|
||||||
.Dt archive_write 3
|
.Dt ARCHIVE_WRITE 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_write_data
|
.Nm archive_write_data
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD: src/lib/libarchive/archive_write_disk.3,v 1.4 2008/09/04 05:22:00 kientzle Exp $
|
.\" $FreeBSD: src/lib/libarchive/archive_write_disk.3,v 1.4 2008/09/04 05:22:00 kientzle Exp $
|
||||||
.\"
|
.\"
|
||||||
.Dd August 5, 2008
|
.Dd August 5, 2008
|
||||||
.Dt archive_write_disk 3
|
.Dt ARCHIVE_WRITE_DISK 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_write_disk_new ,
|
.Nm archive_write_disk_new ,
|
||||||
|
|
|
@ -542,11 +542,36 @@ la_CreateHardLinkW(wchar_t *linkname, wchar_t *target)
|
||||||
{
|
{
|
||||||
static BOOLEAN (WINAPI *f)(LPWSTR, LPWSTR, LPSECURITY_ATTRIBUTES);
|
static BOOLEAN (WINAPI *f)(LPWSTR, LPWSTR, LPSECURITY_ATTRIBUTES);
|
||||||
static int set;
|
static int set;
|
||||||
|
BOOL ret;
|
||||||
|
|
||||||
if (!set) {
|
if (!set) {
|
||||||
set = 1;
|
set = 1;
|
||||||
f = la_GetFunctionKernel32("CreateHardLinkW");
|
f = la_GetFunctionKernel32("CreateHardLinkW");
|
||||||
}
|
}
|
||||||
return f == NULL ? 0 : (*f)(linkname, target, NULL);
|
if (!f)
|
||||||
|
return (0);
|
||||||
|
ret = (*f)(linkname, target, NULL);
|
||||||
|
if (!ret) {
|
||||||
|
/* Under windows 2000, it is necessary to remove
|
||||||
|
* the "\\?\" prefix. */
|
||||||
|
#define IS_UNC(name) ((name[0] == L'U' || name[0] == L'u') && \
|
||||||
|
(name[1] == L'N' || name[1] == L'n') && \
|
||||||
|
(name[2] == L'C' || name[2] == L'c') && \
|
||||||
|
name[3] == L'\\')
|
||||||
|
if (!wcsncmp(linkname,L"\\\\?\\", 4)) {
|
||||||
|
linkname += 4;
|
||||||
|
if (IS_UNC(linkname))
|
||||||
|
linkname += 4;
|
||||||
|
}
|
||||||
|
if (!wcsncmp(target,L"\\\\?\\", 4)) {
|
||||||
|
target += 4;
|
||||||
|
if (IS_UNC(target))
|
||||||
|
target += 4;
|
||||||
|
}
|
||||||
|
#undef IS_UNC
|
||||||
|
ret = (*f)(linkname, target, NULL);
|
||||||
|
}
|
||||||
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -2207,6 +2232,7 @@ create_dir(struct archive_write_disk *a, wchar_t *path)
|
||||||
le->fixup |=TODO_MODE_BASE;
|
le->fixup |=TODO_MODE_BASE;
|
||||||
le->mode = mode_final;
|
le->mode = mode_final;
|
||||||
}
|
}
|
||||||
|
free(full);
|
||||||
return (ARCHIVE_OK);
|
return (ARCHIVE_OK);
|
||||||
} else {
|
} else {
|
||||||
la_dosmaperr(GetLastError());
|
la_dosmaperr(GetLastError());
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd March 23, 2011
|
.Dd March 23, 2011
|
||||||
.Dt archive_write_filter 3
|
.Dt ARCHIVE_WRITE_FILTER 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_write_add_filter_bzip2 ,
|
.Nm archive_write_add_filter_bzip2 ,
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD: head/lib/libarchive/archive_write.3 201110 2009-12-28 03:31:29Z kientzle $
|
.\" $FreeBSD: head/lib/libarchive/archive_write.3 201110 2009-12-28 03:31:29Z kientzle $
|
||||||
.\"
|
.\"
|
||||||
.Dd March 23, 2011
|
.Dd March 23, 2011
|
||||||
.Dt archive_write_finish_entry 3
|
.Dt ARCHIVE_WRITE_FINISH_ENTRY 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_write_finish_entry
|
.Nm archive_write_finish_entry
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd March 23, 2011
|
.Dd March 23, 2011
|
||||||
.Dt archive_write_format 3
|
.Dt ARCHIVE_WRITE_FORMAT 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_write_set_format_cpio ,
|
.Nm archive_write_set_format_cpio ,
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd March 23, 2011
|
.Dd March 23, 2011
|
||||||
.Dt archive_write_free 3
|
.Dt ARCHIVE_WRITE_FREE 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_write_close ,
|
.Nm archive_write_close ,
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd March 23, 2011
|
.Dd March 23, 2011
|
||||||
.Dt archive_write_header 3
|
.Dt ARCHIVE_WRITE_HEADER 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_write_header
|
.Nm archive_write_header
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd March 23, 2011
|
.Dd March 23, 2011
|
||||||
.Dt archive_write_new 3
|
.Dt ARCHIVE_WRITE_NEW 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_write_new
|
.Nm archive_write_new
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD: head/lib/libarchive/archive_write.3 201110 2009-12-28 03:31:29Z kientzle $
|
.\" $FreeBSD: head/lib/libarchive/archive_write.3 201110 2009-12-28 03:31:29Z kientzle $
|
||||||
.\"
|
.\"
|
||||||
.Dd March 23, 2011
|
.Dd March 23, 2011
|
||||||
.Dt archive_write 3
|
.Dt ARCHIVE_WRITE 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_write_open ,
|
.Nm archive_write_open ,
|
||||||
|
|
|
@ -96,7 +96,7 @@ enum la_zaction {
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Universal zstream.
|
* A stream object of universal compressor.
|
||||||
*/
|
*/
|
||||||
struct la_zstream {
|
struct la_zstream {
|
||||||
const uint8_t *next_in;
|
const uint8_t *next_in;
|
||||||
|
@ -154,8 +154,8 @@ struct file {
|
||||||
#define HAS_STREAM (1<<4)
|
#define HAS_STREAM (1<<4)
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
time_t time;
|
time_t time;
|
||||||
long time_ns;
|
long time_ns;
|
||||||
} times[3];
|
} times[3];
|
||||||
#define MTIME 0
|
#define MTIME 0
|
||||||
#define ATIME 1
|
#define ATIME 1
|
||||||
|
@ -455,6 +455,7 @@ _7z_write_header(struct archive_write *a, struct archive_entry *entry)
|
||||||
zip->total_number_entry++;
|
zip->total_number_entry++;
|
||||||
zip->total_bytes_entry_name += file->name_len + 2;
|
zip->total_bytes_entry_name += file->name_len + 2;
|
||||||
if (file->size == 0) {
|
if (file->size == 0) {
|
||||||
|
/* Count up the number of empty files. */
|
||||||
zip->total_number_empty_entry++;
|
zip->total_number_empty_entry++;
|
||||||
if (file->dir)
|
if (file->dir)
|
||||||
zip->total_number_dir_entry++;
|
zip->total_number_dir_entry++;
|
||||||
|
@ -488,6 +489,9 @@ _7z_write_header(struct archive_write *a, struct archive_entry *entry)
|
||||||
zip->entry_bytes_remaining = file->size;
|
zip->entry_bytes_remaining = file->size;
|
||||||
zip->entry_crc32 = 0;
|
zip->entry_crc32 = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Store a symbolic link name as file contents.
|
||||||
|
*/
|
||||||
if (archive_entry_filetype(entry) == AE_IFLNK) {
|
if (archive_entry_filetype(entry) == AE_IFLNK) {
|
||||||
ssize_t bytes;
|
ssize_t bytes;
|
||||||
const void *p = (const void *)archive_entry_symlink(entry);
|
const void *p = (const void *)archive_entry_symlink(entry);
|
||||||
|
@ -501,6 +505,9 @@ _7z_write_header(struct archive_write *a, struct archive_entry *entry)
|
||||||
return (r);
|
return (r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write data to a temporary file.
|
||||||
|
*/
|
||||||
static int
|
static int
|
||||||
write_to_temp(struct archive_write *a, const void *buff, size_t s)
|
write_to_temp(struct archive_write *a, const void *buff, size_t s)
|
||||||
{
|
{
|
||||||
|
@ -719,19 +726,22 @@ _7z_close(struct archive_write *a)
|
||||||
zip->total_number_nonempty_entry =
|
zip->total_number_nonempty_entry =
|
||||||
zip->total_number_entry - zip->total_number_empty_entry;
|
zip->total_number_entry - zip->total_number_empty_entry;
|
||||||
|
|
||||||
|
/* Connect an empty file list. */
|
||||||
*zip->file_list.last = zip->empty_list.first;
|
*zip->file_list.last = zip->empty_list.first;
|
||||||
zip->file_list.last = zip->empty_list.last;
|
zip->file_list.last = zip->empty_list.last;
|
||||||
|
/* Connect a directory file list. */
|
||||||
ARCHIVE_RB_TREE_FOREACH(n, &(zip->rbtree)) {
|
ARCHIVE_RB_TREE_FOREACH(n, &(zip->rbtree)) {
|
||||||
file_register(zip, (struct file *)n);
|
file_register(zip, (struct file *)n);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NOTE: 7z command supports just LZMA1, LZMA2 and COPY for
|
* NOTE: 7z command supports just LZMA1, LZMA2 and COPY for
|
||||||
* the header.
|
* the compression type for encoding the header.
|
||||||
*/
|
*/
|
||||||
#if HAVE_LZMA_H
|
#if HAVE_LZMA_H
|
||||||
header_compression = _7Z_LZMA1;
|
header_compression = _7Z_LZMA1;
|
||||||
/* If the stored file is only one, do not encode the header. */
|
/* If the stored file is only one, do not encode the header.
|
||||||
|
* This is the same way 7z command does. */
|
||||||
if (zip->total_number_entry == 1)
|
if (zip->total_number_entry == 1)
|
||||||
header_compression = _7Z_COPY;
|
header_compression = _7Z_COPY;
|
||||||
#else
|
#else
|
||||||
|
@ -823,6 +833,9 @@ _7z_close(struct archive_write *a)
|
||||||
return (r);
|
return (r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Encode 64 bits value into 7-Zip's encoded UINT64 value.
|
||||||
|
*/
|
||||||
static int
|
static int
|
||||||
enc_uint64(struct archive_write *a, uint64_t val)
|
enc_uint64(struct archive_write *a, uint64_t val)
|
||||||
{
|
{
|
||||||
|
@ -1586,6 +1599,9 @@ compression_unsupported_encoder(struct archive *a,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* _7_COPY compressor.
|
||||||
|
*/
|
||||||
static int
|
static int
|
||||||
compression_init_encoder_copy(struct archive *a, struct la_zstream *lastrm)
|
compression_init_encoder_copy(struct archive *a, struct la_zstream *lastrm)
|
||||||
{
|
{
|
||||||
|
@ -1631,6 +1647,9 @@ compression_end_copy(struct archive *a, struct la_zstream *lastrm)
|
||||||
return (ARCHIVE_OK);
|
return (ARCHIVE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* _7_DEFLATE compressor.
|
||||||
|
*/
|
||||||
#ifdef HAVE_ZLIB_H
|
#ifdef HAVE_ZLIB_H
|
||||||
static int
|
static int
|
||||||
compression_init_encoder_deflate(struct archive *a,
|
compression_init_encoder_deflate(struct archive *a,
|
||||||
|
@ -1741,6 +1760,9 @@ compression_init_encoder_deflate(struct archive *a,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* _7_BZIP2 compressor.
|
||||||
|
*/
|
||||||
#if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR)
|
#if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR)
|
||||||
static int
|
static int
|
||||||
compression_init_encoder_bzip2(struct archive *a,
|
compression_init_encoder_bzip2(struct archive *a,
|
||||||
|
@ -1860,6 +1882,9 @@ compression_init_encoder_bzip2(struct archive *a,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* _7_LZMA1, _7_LZMA2 compressor.
|
||||||
|
*/
|
||||||
#if defined(HAVE_LZMA_H)
|
#if defined(HAVE_LZMA_H)
|
||||||
static int
|
static int
|
||||||
compression_init_encoder_lzma(struct archive *a,
|
compression_init_encoder_lzma(struct archive *a,
|
||||||
|
@ -2047,7 +2072,7 @@ compression_init_encoder_lzma2(struct archive *a,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PPMd compression.
|
* _7_PPMD compressor.
|
||||||
*/
|
*/
|
||||||
static void *
|
static void *
|
||||||
ppmd_alloc(void *p, size_t size)
|
ppmd_alloc(void *p, size_t size)
|
||||||
|
@ -2201,6 +2226,9 @@ compression_end_ppmd(struct archive *a, struct la_zstream *lastrm)
|
||||||
return (ARCHIVE_OK);
|
return (ARCHIVE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Universal compressor initializer.
|
||||||
|
*/
|
||||||
static int
|
static int
|
||||||
_7z_compression_init_encoder(struct archive_write *a, unsigned compression,
|
_7z_compression_init_encoder(struct archive_write *a, unsigned compression,
|
||||||
int compression_level)
|
int compression_level)
|
||||||
|
|
|
@ -684,21 +684,24 @@ xar_write_data(struct archive_write *a, const void *buff, size_t s)
|
||||||
|
|
||||||
archive_string_empty(&(xar->cur_file->script));
|
archive_string_empty(&(xar->cur_file->script));
|
||||||
if (rsize > 2 && b[0] == '#' && b[1] == '!') {
|
if (rsize > 2 && b[0] == '#' && b[1] == '!') {
|
||||||
char path[PATH_MAX];
|
|
||||||
size_t i, end, off;
|
size_t i, end, off;
|
||||||
|
|
||||||
end = sizeof(path);
|
|
||||||
if (end > rsize)
|
|
||||||
end = rsize;
|
|
||||||
off = 2;
|
off = 2;
|
||||||
if (b[off] == ' ')
|
if (b[off] == ' ')
|
||||||
off++;
|
off++;
|
||||||
|
#ifdef PATH_MAX
|
||||||
|
if ((rsize - off) > PATH_MAX)
|
||||||
|
end = off + PATH_MAX;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
end = rsize;
|
||||||
|
/* Find the end of a script path. */
|
||||||
for (i = off; i < end && b[i] != '\0' &&
|
for (i = off; i < end && b[i] != '\0' &&
|
||||||
b[i] != '\n' && b[i] != '\r' &&
|
b[i] != '\n' && b[i] != '\r' &&
|
||||||
b[i] != ' ' && b[i] != '\t'; i++)
|
b[i] != ' ' && b[i] != '\t'; i++)
|
||||||
path[i - off] = b[i];
|
;
|
||||||
path[i - off] = '\0';
|
archive_strncpy(&(xar->cur_file->script), b + off,
|
||||||
archive_strcpy(&(xar->cur_file->script), path);
|
i - off);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -96,11 +96,13 @@ enum compression {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static ssize_t archive_write_zip_data(struct archive_write *, const void *buff, size_t s);
|
static ssize_t archive_write_zip_data(struct archive_write *,
|
||||||
|
const void *buff, size_t s);
|
||||||
static int archive_write_zip_close(struct archive_write *);
|
static int archive_write_zip_close(struct archive_write *);
|
||||||
static int archive_write_zip_free(struct archive_write *);
|
static int archive_write_zip_free(struct archive_write *);
|
||||||
static int archive_write_zip_finish_entry(struct archive_write *);
|
static int archive_write_zip_finish_entry(struct archive_write *);
|
||||||
static int archive_write_zip_header(struct archive_write *, struct archive_entry *);
|
static int archive_write_zip_header(struct archive_write *,
|
||||||
|
struct archive_entry *);
|
||||||
static int archive_write_zip_options(struct archive_write *,
|
static int archive_write_zip_options(struct archive_write *,
|
||||||
const char *, const char *);
|
const char *, const char *);
|
||||||
static unsigned int dos_time(const time_t);
|
static unsigned int dos_time(const time_t);
|
||||||
|
@ -270,7 +272,8 @@ archive_write_set_format_zip(struct archive *_a)
|
||||||
|
|
||||||
zip = (struct zip *) calloc(1, sizeof(*zip));
|
zip = (struct zip *) calloc(1, sizeof(*zip));
|
||||||
if (zip == NULL) {
|
if (zip == NULL) {
|
||||||
archive_set_error(&a->archive, ENOMEM, "Can't allocate zip data");
|
archive_set_error(&a->archive, ENOMEM,
|
||||||
|
"Can't allocate zip data");
|
||||||
return (ARCHIVE_FATAL);
|
return (ARCHIVE_FATAL);
|
||||||
}
|
}
|
||||||
zip->central_directory = NULL;
|
zip->central_directory = NULL;
|
||||||
|
@ -284,7 +287,8 @@ archive_write_set_format_zip(struct archive *_a)
|
||||||
zip->len_buf = 65536;
|
zip->len_buf = 65536;
|
||||||
zip->buf = malloc(zip->len_buf);
|
zip->buf = malloc(zip->len_buf);
|
||||||
if (zip->buf == NULL) {
|
if (zip->buf == NULL) {
|
||||||
archive_set_error(&a->archive, ENOMEM, "Can't allocate compression buffer");
|
archive_set_error(&a->archive, ENOMEM,
|
||||||
|
"Can't allocate compression buffer");
|
||||||
return (ARCHIVE_FATAL);
|
return (ARCHIVE_FATAL);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -335,7 +339,7 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry)
|
||||||
|
|
||||||
/* Entries other than a regular file or a folder are skipped. */
|
/* Entries other than a regular file or a folder are skipped. */
|
||||||
type = archive_entry_filetype(entry);
|
type = archive_entry_filetype(entry);
|
||||||
if ((type != AE_IFREG) & (type != AE_IFDIR)) {
|
if (type != AE_IFREG && type != AE_IFDIR && type != AE_IFLNK) {
|
||||||
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
|
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
|
||||||
"Filetype not supported");
|
"Filetype not supported");
|
||||||
return ARCHIVE_FAILED;
|
return ARCHIVE_FAILED;
|
||||||
|
@ -410,8 +414,20 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry)
|
||||||
|
|
||||||
/* Initialize the CRC variable and potentially the local crc32(). */
|
/* Initialize the CRC variable and potentially the local crc32(). */
|
||||||
l->crc32 = crc32(0, NULL, 0);
|
l->crc32 = crc32(0, NULL, 0);
|
||||||
l->compression = zip->compression;
|
if (type == AE_IFLNK) {
|
||||||
l->compressed_size = 0;
|
const char *p = archive_entry_symlink(l->entry);
|
||||||
|
if (p != NULL)
|
||||||
|
size = strlen(p);
|
||||||
|
else
|
||||||
|
size = 0;
|
||||||
|
zip->remaining_data_bytes = 0;
|
||||||
|
archive_entry_set_size(l->entry, size);
|
||||||
|
l->compression = COMPRESSION_STORE;
|
||||||
|
l->compressed_size = size;
|
||||||
|
} else {
|
||||||
|
l->compression = zip->compression;
|
||||||
|
l->compressed_size = 0;
|
||||||
|
}
|
||||||
l->next = NULL;
|
l->next = NULL;
|
||||||
if (zip->central_directory == NULL) {
|
if (zip->central_directory == NULL) {
|
||||||
zip->central_directory = l;
|
zip->central_directory = l;
|
||||||
|
@ -420,22 +436,24 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry)
|
||||||
}
|
}
|
||||||
zip->central_directory_end = l;
|
zip->central_directory_end = l;
|
||||||
|
|
||||||
/* Store the offset of this header for later use in central directory. */
|
/* Store the offset of this header for later use in central
|
||||||
|
* directory. */
|
||||||
l->offset = zip->written_bytes;
|
l->offset = zip->written_bytes;
|
||||||
|
|
||||||
memset(&h, 0, sizeof(h));
|
memset(&h, 0, sizeof(h));
|
||||||
archive_le32enc(&h.signature, ZIP_SIGNATURE_LOCAL_FILE_HEADER);
|
archive_le32enc(&h.signature, ZIP_SIGNATURE_LOCAL_FILE_HEADER);
|
||||||
archive_le16enc(&h.version, ZIP_VERSION_EXTRACT);
|
archive_le16enc(&h.version, ZIP_VERSION_EXTRACT);
|
||||||
archive_le16enc(&h.flags, l->flags);
|
archive_le16enc(&h.flags, l->flags);
|
||||||
archive_le16enc(&h.compression, zip->compression);
|
archive_le16enc(&h.compression, l->compression);
|
||||||
archive_le32enc(&h.timedate, dos_time(archive_entry_mtime(entry)));
|
archive_le32enc(&h.timedate, dos_time(archive_entry_mtime(entry)));
|
||||||
archive_le16enc(&h.filename_length, (uint16_t)path_length(l->entry));
|
archive_le16enc(&h.filename_length, (uint16_t)path_length(l->entry));
|
||||||
|
|
||||||
switch (zip->compression) {
|
switch (l->compression) {
|
||||||
case COMPRESSION_STORE:
|
case COMPRESSION_STORE:
|
||||||
/* Setting compressed and uncompressed sizes even when specification says
|
/* Setting compressed and uncompressed sizes even when
|
||||||
* to set to zero when using data descriptors. Otherwise the end of the
|
* specification says to set to zero when using data
|
||||||
* data for an entry is rather difficult to find. */
|
* descriptors. Otherwise the end of the data for an
|
||||||
|
* entry is rather difficult to find. */
|
||||||
archive_le32enc(&h.compressed_size, size);
|
archive_le32enc(&h.compressed_size, size);
|
||||||
archive_le32enc(&h.uncompressed_size, size);
|
archive_le32enc(&h.uncompressed_size, size);
|
||||||
break;
|
break;
|
||||||
|
@ -448,8 +466,8 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry)
|
||||||
zip->stream.opaque = Z_NULL;
|
zip->stream.opaque = Z_NULL;
|
||||||
zip->stream.next_out = zip->buf;
|
zip->stream.next_out = zip->buf;
|
||||||
zip->stream.avail_out = zip->len_buf;
|
zip->stream.avail_out = zip->len_buf;
|
||||||
if (deflateInit2(&zip->stream, Z_DEFAULT_COMPRESSION, Z_DEFLATED,
|
if (deflateInit2(&zip->stream, Z_DEFAULT_COMPRESSION,
|
||||||
-15, 8, Z_DEFAULT_STRATEGY) != Z_OK) {
|
Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY) != Z_OK) {
|
||||||
archive_set_error(&a->archive, ENOMEM,
|
archive_set_error(&a->archive, ENOMEM,
|
||||||
"Can't init deflate compressor");
|
"Can't init deflate compressor");
|
||||||
return (ARCHIVE_FATAL);
|
return (ARCHIVE_FATAL);
|
||||||
|
@ -495,6 +513,17 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry)
|
||||||
return (ARCHIVE_FATAL);
|
return (ARCHIVE_FATAL);
|
||||||
zip->written_bytes += sizeof(e);
|
zip->written_bytes += sizeof(e);
|
||||||
|
|
||||||
|
if (type == AE_IFLNK) {
|
||||||
|
const unsigned char *p;
|
||||||
|
|
||||||
|
p = (const unsigned char *)archive_entry_symlink(l->entry);
|
||||||
|
ret = __archive_write_output(a, p, size);
|
||||||
|
if (ret != ARCHIVE_OK)
|
||||||
|
return (ARCHIVE_FATAL);
|
||||||
|
zip->written_bytes += size;
|
||||||
|
l->crc32 = crc32(l->crc32, p, size);
|
||||||
|
}
|
||||||
|
|
||||||
if (ret2 != ARCHIVE_OK)
|
if (ret2 != ARCHIVE_OK)
|
||||||
return (ret2);
|
return (ret2);
|
||||||
return (ARCHIVE_OK);
|
return (ARCHIVE_OK);
|
||||||
|
@ -512,7 +541,7 @@ archive_write_zip_data(struct archive_write *a, const void *buff, size_t s)
|
||||||
|
|
||||||
if (s == 0) return 0;
|
if (s == 0) return 0;
|
||||||
|
|
||||||
switch (zip->compression) {
|
switch (l->compression) {
|
||||||
case COMPRESSION_STORE:
|
case COMPRESSION_STORE:
|
||||||
ret = __archive_write_output(a, buff, s);
|
ret = __archive_write_output(a, buff, s);
|
||||||
if (ret != ARCHIVE_OK) return (ret);
|
if (ret != ARCHIVE_OK) return (ret);
|
||||||
|
@ -530,7 +559,8 @@ archive_write_zip_data(struct archive_write *a, const void *buff, size_t s)
|
||||||
if (ret == Z_STREAM_ERROR)
|
if (ret == Z_STREAM_ERROR)
|
||||||
return (ARCHIVE_FATAL);
|
return (ARCHIVE_FATAL);
|
||||||
if (zip->stream.avail_out == 0) {
|
if (zip->stream.avail_out == 0) {
|
||||||
ret = __archive_write_output(a, zip->buf, zip->len_buf);
|
ret = __archive_write_output(a, zip->buf,
|
||||||
|
zip->len_buf);
|
||||||
if (ret != ARCHIVE_OK)
|
if (ret != ARCHIVE_OK)
|
||||||
return (ret);
|
return (ret);
|
||||||
l->compressed_size += zip->len_buf;
|
l->compressed_size += zip->len_buf;
|
||||||
|
@ -564,7 +594,7 @@ archive_write_zip_finish_entry(struct archive_write *a)
|
||||||
size_t reminder;
|
size_t reminder;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch(zip->compression) {
|
switch(l->compression) {
|
||||||
case COMPRESSION_STORE:
|
case COMPRESSION_STORE:
|
||||||
break;
|
break;
|
||||||
#if HAVE_ZLIB_H
|
#if HAVE_ZLIB_H
|
||||||
|
@ -614,7 +644,8 @@ archive_write_zip_close(struct archive_write *a)
|
||||||
l = zip->central_directory;
|
l = zip->central_directory;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Formatting central directory file header fields that are fixed for all entries.
|
* Formatting central directory file header fields that are
|
||||||
|
* fixed for all entries.
|
||||||
* Fields not used (and therefor 0) are:
|
* Fields not used (and therefor 0) are:
|
||||||
*
|
*
|
||||||
* - comment_length
|
* - comment_length
|
||||||
|
@ -634,18 +665,23 @@ archive_write_zip_close(struct archive_write *a)
|
||||||
while (l != NULL) {
|
while (l != NULL) {
|
||||||
archive_le16enc(&h.flags, l->flags);
|
archive_le16enc(&h.flags, l->flags);
|
||||||
archive_le16enc(&h.compression, l->compression);
|
archive_le16enc(&h.compression, l->compression);
|
||||||
archive_le32enc(&h.timedate, dos_time(archive_entry_mtime(l->entry)));
|
archive_le32enc(&h.timedate,
|
||||||
|
dos_time(archive_entry_mtime(l->entry)));
|
||||||
archive_le32enc(&h.crc32, l->crc32);
|
archive_le32enc(&h.crc32, l->crc32);
|
||||||
archive_le32enc(&h.compressed_size, l->compressed_size);
|
archive_le32enc(&h.compressed_size, l->compressed_size);
|
||||||
archive_le32enc(&h.uncompressed_size, archive_entry_size(l->entry));
|
archive_le32enc(&h.uncompressed_size,
|
||||||
archive_le16enc(&h.filename_length, (uint16_t)path_length(l->entry));
|
archive_entry_size(l->entry));
|
||||||
|
archive_le16enc(&h.filename_length,
|
||||||
|
(uint16_t)path_length(l->entry));
|
||||||
archive_le16enc(&h.extra_length, sizeof(e));
|
archive_le16enc(&h.extra_length, sizeof(e));
|
||||||
archive_le16enc(&h.attributes_external[2], archive_entry_mode(l->entry));
|
archive_le16enc(&h.attributes_external[2],
|
||||||
|
archive_entry_mode(l->entry));
|
||||||
archive_le32enc(&h.offset, l->offset);
|
archive_le32enc(&h.offset, l->offset);
|
||||||
|
|
||||||
/* Formatting extra data. */
|
/* Formatting extra data. */
|
||||||
archive_le16enc(&e.time_id, ZIP_SIGNATURE_EXTRA_TIMESTAMP);
|
archive_le16enc(&e.time_id, ZIP_SIGNATURE_EXTRA_TIMESTAMP);
|
||||||
archive_le16enc(&e.time_size, sizeof(e.mtime) + sizeof(e.time_flag));
|
archive_le16enc(&e.time_size,
|
||||||
|
sizeof(e.mtime) + sizeof(e.time_flag));
|
||||||
e.time_flag[0] = 0x07;
|
e.time_flag[0] = 0x07;
|
||||||
archive_le32enc(&e.mtime, archive_entry_mtime(l->entry));
|
archive_le32enc(&e.mtime, archive_entry_mtime(l->entry));
|
||||||
archive_le16enc(&e.unix_id, ZIP_SIGNATURE_EXTRA_NEW_UNIX);
|
archive_le16enc(&e.unix_id, ZIP_SIGNATURE_EXTRA_NEW_UNIX);
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD: head/lib/libarchive/archive_write.3 201110 2009-12-28 03:31:29Z kientzle $
|
.\" $FreeBSD: head/lib/libarchive/archive_write.3 201110 2009-12-28 03:31:29Z kientzle $
|
||||||
.\"
|
.\"
|
||||||
.Dd Feb 27, 2010
|
.Dd Feb 27, 2010
|
||||||
.Dt archive_write_options 3
|
.Dt ARCHIVE_WRITE_OPTIONS 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm archive_write_set_filter_option ,
|
.Nm archive_write_set_filter_option ,
|
||||||
|
|
|
@ -268,31 +268,6 @@ data, including ACLs and extended attributes, as special
|
||||||
entries in cpio archives.
|
entries in cpio archives.
|
||||||
.Pp
|
.Pp
|
||||||
XXX Others? XXX
|
XXX Others? XXX
|
||||||
.Sh BUGS
|
|
||||||
The
|
|
||||||
.Dq CRC
|
|
||||||
format is mis-named, as it uses a simple checksum and
|
|
||||||
not a cyclic redundancy check.
|
|
||||||
.Pp
|
|
||||||
The old binary format is limited to 16 bits for user id,
|
|
||||||
group id, device, and inode numbers.
|
|
||||||
It is limited to 4 gigabyte file sizes.
|
|
||||||
.Pp
|
|
||||||
The old ASCII format is limited to 18 bits for
|
|
||||||
the user id, group id, device, and inode numbers.
|
|
||||||
It is limited to 8 gigabyte file sizes.
|
|
||||||
.Pp
|
|
||||||
The new ASCII format is limited to 4 gigabyte file sizes.
|
|
||||||
.Pp
|
|
||||||
None of the cpio formats store user or group names,
|
|
||||||
which are essential when moving files between systems with
|
|
||||||
dissimilar user or group numbering.
|
|
||||||
.Pp
|
|
||||||
Especially when writing older cpio variants, it may be necessary
|
|
||||||
to map actual device/inode values to synthesized values that
|
|
||||||
fit the available fields.
|
|
||||||
With very large filesystems, this may be necessary even for
|
|
||||||
the newer formats.
|
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr cpio 1 ,
|
.Xr cpio 1 ,
|
||||||
.Xr tar 5
|
.Xr tar 5
|
||||||
|
@ -323,3 +298,28 @@ license.
|
||||||
The character format was adopted as part of
|
The character format was adopted as part of
|
||||||
.St -p1003.1-88 .
|
.St -p1003.1-88 .
|
||||||
XXX when did "newc" appear? Who invented it? When did HP come out with their variant? When did Sun introduce ACLs and extended attributes? XXX
|
XXX when did "newc" appear? Who invented it? When did HP come out with their variant? When did Sun introduce ACLs and extended attributes? XXX
|
||||||
|
.Sh BUGS
|
||||||
|
The
|
||||||
|
.Dq CRC
|
||||||
|
format is mis-named, as it uses a simple checksum and
|
||||||
|
not a cyclic redundancy check.
|
||||||
|
.Pp
|
||||||
|
The old binary format is limited to 16 bits for user id,
|
||||||
|
group id, device, and inode numbers.
|
||||||
|
It is limited to 4 gigabyte file sizes.
|
||||||
|
.Pp
|
||||||
|
The old ASCII format is limited to 18 bits for
|
||||||
|
the user id, group id, device, and inode numbers.
|
||||||
|
It is limited to 8 gigabyte file sizes.
|
||||||
|
.Pp
|
||||||
|
The new ASCII format is limited to 4 gigabyte file sizes.
|
||||||
|
.Pp
|
||||||
|
None of the cpio formats store user or group names,
|
||||||
|
which are essential when moving files between systems with
|
||||||
|
dissimilar user or group numbering.
|
||||||
|
.Pp
|
||||||
|
Especially when writing older cpio variants, it may be necessary
|
||||||
|
to map actual device/inode values to synthesized values that
|
||||||
|
fit the available fields.
|
||||||
|
With very large filesystems, this may be necessary even for
|
||||||
|
the newer formats.
|
||||||
|
|
|
@ -32,69 +32,73 @@
|
||||||
pid_t
|
pid_t
|
||||||
__archive_create_child(const char *path, int *child_stdin, int *child_stdout)
|
__archive_create_child(const char *path, int *child_stdin, int *child_stdout)
|
||||||
{
|
{
|
||||||
HANDLE childStdout[2], childStdin[2], childStdinWr, childStdoutRd;
|
HANDLE childStdout[2], childStdin[2],childStderr;
|
||||||
SECURITY_ATTRIBUTES secAtts;
|
SECURITY_ATTRIBUTES secAtts;
|
||||||
STARTUPINFO staInfo;
|
STARTUPINFO staInfo;
|
||||||
PROCESS_INFORMATION childInfo;
|
PROCESS_INFORMATION childInfo;
|
||||||
char cmd[MAX_PATH];
|
char cmd[MAX_PATH];
|
||||||
DWORD mode;
|
|
||||||
|
|
||||||
secAtts.nLength = sizeof(SECURITY_ATTRIBUTES);
|
secAtts.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||||
secAtts.bInheritHandle = TRUE;
|
secAtts.bInheritHandle = TRUE;
|
||||||
secAtts.lpSecurityDescriptor = NULL;
|
secAtts.lpSecurityDescriptor = NULL;
|
||||||
if (CreatePipe(&childStdout[0], &childStdout[1], &secAtts, 0) == 0)
|
if (CreatePipe(&childStdout[0], &childStdout[1], &secAtts, 0) == 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
if (DuplicateHandle(GetCurrentProcess(), childStdout[0],
|
if (!SetHandleInformation(childStdout[0], HANDLE_FLAG_INHERIT, 0))
|
||||||
GetCurrentProcess(), &childStdoutRd, 0, FALSE,
|
{
|
||||||
DUPLICATE_SAME_ACCESS) == 0) {
|
|
||||||
CloseHandle(childStdout[0]);
|
CloseHandle(childStdout[0]);
|
||||||
CloseHandle(childStdout[1]);
|
CloseHandle(childStdout[1]);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
CloseHandle(childStdout[0]);
|
|
||||||
|
|
||||||
if (CreatePipe(&childStdin[0], &childStdin[1], &secAtts, 0) == 0) {
|
if (CreatePipe(&childStdin[0], &childStdin[1], &secAtts, 0) == 0) {
|
||||||
CloseHandle(childStdoutRd);
|
CloseHandle(childStdout[0]);
|
||||||
CloseHandle(childStdout[1]);
|
CloseHandle(childStdout[1]);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
if (!SetHandleInformation(childStdin[1], HANDLE_FLAG_INHERIT, 0))
|
||||||
if (DuplicateHandle(GetCurrentProcess(), childStdin[1],
|
{
|
||||||
GetCurrentProcess(), &childStdinWr, 0, FALSE,
|
CloseHandle(childStdout[0]);
|
||||||
DUPLICATE_SAME_ACCESS) == 0) {
|
CloseHandle(childStdout[1]);
|
||||||
CloseHandle(childStdoutRd);
|
CloseHandle(childStdin[0]);
|
||||||
|
CloseHandle(childStdin[1]);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
if (DuplicateHandle(GetCurrentProcess(), GetStdHandle(STD_ERROR_HANDLE),
|
||||||
|
GetCurrentProcess(), &childStderr, 0, TRUE,
|
||||||
|
DUPLICATE_SAME_ACCESS) == 0) {
|
||||||
|
CloseHandle(childStdout[0]);
|
||||||
CloseHandle(childStdout[1]);
|
CloseHandle(childStdout[1]);
|
||||||
CloseHandle(childStdin[0]);
|
CloseHandle(childStdin[0]);
|
||||||
CloseHandle(childStdin[1]);
|
CloseHandle(childStdin[1]);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
CloseHandle(childStdin[1]);
|
|
||||||
|
|
||||||
memset(&staInfo, 0, sizeof(staInfo));
|
memset(&staInfo, 0, sizeof(staInfo));
|
||||||
staInfo.cb = sizeof(staInfo);
|
staInfo.cb = sizeof(staInfo);
|
||||||
|
staInfo.hStdError = childStderr;
|
||||||
staInfo.hStdOutput = childStdout[1];
|
staInfo.hStdOutput = childStdout[1];
|
||||||
staInfo.hStdInput = childStdin[0];
|
staInfo.hStdInput = childStdin[0];
|
||||||
staInfo.wShowWindow = SW_HIDE;
|
staInfo.wShowWindow = SW_HIDE;
|
||||||
staInfo.dwFlags = STARTF_USEFILLATTRIBUTE | STARTF_USECOUNTCHARS |
|
staInfo.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
|
||||||
STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
|
|
||||||
strncpy(cmd, path, sizeof(cmd)-1);
|
strncpy(cmd, path, sizeof(cmd)-1);
|
||||||
cmd[sizeof(cmd)-1] = '\0';
|
cmd[sizeof(cmd)-1] = '\0';
|
||||||
if (CreateProcessA(NULL, cmd, NULL, NULL, TRUE, 0, NULL, NULL,
|
if (CreateProcessA(NULL, cmd, NULL, NULL, TRUE, 0, NULL, NULL,
|
||||||
&staInfo, &childInfo) == 0) {
|
&staInfo, &childInfo) == 0) {
|
||||||
CloseHandle(childStdoutRd);
|
CloseHandle(childStdout[0]);
|
||||||
CloseHandle(childStdout[1]);
|
CloseHandle(childStdout[1]);
|
||||||
CloseHandle(childStdin[0]);
|
CloseHandle(childStdin[0]);
|
||||||
CloseHandle(childStdinWr);
|
CloseHandle(childStdin[1]);
|
||||||
|
CloseHandle(childStderr);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
WaitForInputIdle(childInfo.hProcess, INFINITE);
|
WaitForInputIdle(childInfo.hProcess, INFINITE);
|
||||||
CloseHandle(childInfo.hProcess);
|
CloseHandle(childInfo.hProcess);
|
||||||
CloseHandle(childInfo.hThread);
|
CloseHandle(childInfo.hThread);
|
||||||
|
|
||||||
mode = PIPE_NOWAIT;
|
*child_stdout = _open_osfhandle((intptr_t)childStdout[0], _O_RDONLY);
|
||||||
SetNamedPipeHandleState(childStdoutRd, &mode, NULL, NULL);
|
*child_stdin = _open_osfhandle((intptr_t)childStdin[1], _O_WRONLY);
|
||||||
*child_stdout = _open_osfhandle((intptr_t)childStdoutRd, _O_RDONLY);
|
|
||||||
*child_stdin = _open_osfhandle((intptr_t)childStdinWr, _O_WRONLY);
|
CloseHandle(childStdout[1]);
|
||||||
|
CloseHandle(childStdin[0]);
|
||||||
|
|
||||||
return (childInfo.dwProcessId);
|
return (childInfo.dwProcessId);
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD: head/lib/libarchive/libarchive-formats.5 201077 2009-12-28 01:50:23Z kientzle $
|
.\" $FreeBSD: head/lib/libarchive/libarchive-formats.5 201077 2009-12-28 01:50:23Z kientzle $
|
||||||
.\"
|
.\"
|
||||||
.Dd December 27, 2009
|
.Dd December 27, 2009
|
||||||
.Dt libarchive-formats 5
|
.Dt LIBARCHIVE-FORMATS 5
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm libarchive-formats
|
.Nm libarchive-formats
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd March 27, 2011
|
.Dd March 27, 2011
|
||||||
.Dt libarchive_changes 3
|
.Dt LIBARCHIVE_CHANGES 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm changes in libarchive interface
|
.Nm changes in libarchive interface
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\" $FreeBSD: head/lib/libarchive/tar.5 201077 2009-12-28 01:50:23Z kientzle $
|
.\" $FreeBSD: head/lib/libarchive/tar.5 201077 2009-12-28 01:50:23Z kientzle $
|
||||||
.\"
|
.\"
|
||||||
.Dd December 27, 2009
|
.Dd December 27, 2009
|
||||||
.Dt tar 5
|
.Dt TAR 5
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm tar
|
.Nm tar
|
||||||
|
|
Loading…
Reference in New Issue