]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
IFC: Portability fixes, per Ivailo Petrov
authorTim Kientzle <kientzle@gmail.com>
Thu, 11 Sep 2008 22:21:39 +0000 (18:21 -0400)
committerTim Kientzle <kientzle@gmail.com>
Thu, 11 Sep 2008 22:21:39 +0000 (18:21 -0400)
SVN-Revision: 200

libarchive/archive_platform.h
libarchive/archive_read_support_compression_program.c
libarchive/archive_write_disk.c
libarchive/config_freebsd.h

index 99dfacc50f5372ce017805bfc7026e8edc59144e..b39b302fd16e00cbb61010c81e355d99cdcfd6a2 100644 (file)
@@ -22,7 +22,7 @@
  * (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: src/lib/libarchive/archive_platform.h,v 1.30 2008/05/26 17:00:22 kientzle Exp $
+ * $FreeBSD: src/lib/libarchive/archive_platform.h,v 1.31 2008/09/12 04:03:34 kientzle Exp $
  */
 
 /*
@@ -78,6 +78,9 @@
 #if !HAVE_DECL_SIZE_MAX
 #define        SIZE_MAX (~(size_t)0)
 #endif
+#if !HAVE_DECL_SSIZE_MAX
+#define        SSIZE_MAX ((ssize_t)(SIZE_MAX >> 1))
+#endif
 #if !HAVE_DECL_UINT32_MAX
 #define        UINT32_MAX (~(uint32_t)0)
 #endif
index 4f25d6ed56159aa694702dfb847ab767702c2613..ad2e2c289acd820fe7eb21a67094e2c464b03169 100644 (file)
  */
 
 #include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_compression_program.c,v 1.4 2008/06/15 10:45:57 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_compression_program.c,v 1.5 2008/09/12 03:53:54 kientzle Exp $");
 
 /* This capability is only available on POSIX systems. */
 #if !defined(HAVE_PIPE) || !defined(HAVE_FCNTL) || \
     !(defined(HAVE_FORK) || defined(HAVE_VFORK))
 
+#include "archive.h"
+
 /*
  * On non-Posix systems, allow the program to build, but choke if
  * this function is actually invoked.
index b385978f17dd3b884575dc77324de9c2371d3319..7a301ffe369cf04fb1d0f7b87e8159bf93e30577 100644 (file)
@@ -25,7 +25,7 @@
  */
 
 #include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.36 2008/09/07 05:22:33 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.38 2008/09/12 04:08:11 kientzle Exp $");
 
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
@@ -514,9 +514,15 @@ write_data_block(struct archive_write_disk *a,
        }
 
        if (a->flags & ARCHIVE_EXTRACT_SPARSE) {
+#if HAVE_STRUCT_STAT_ST_BLKSIZE
                if ((r = _archive_write_disk_lazy_stat(a)) != ARCHIVE_OK)
                        return (r);
                block_size = a->pst->st_blksize;
+#else
+               /* XXX TODO XXX Is there a more appropriate choice here ? */
+               /* This needn't match the filesystem allocation size. */
+               block_size = 16*1024;
+#endif
        }
 
        if (a->filesize >= 0 && (off_t)(offset + size) > a->filesize)
@@ -631,12 +637,14 @@ _archive_write_finish_entry(struct archive *_a)
                /* Last write ended at exactly the filesize; we're done. */
                /* Hopefully, this is the common case. */
        } else {
+#if HAVE_FTRUNCATE
                if (ftruncate(a->fd, a->filesize) == -1 &&
                    a->filesize == 0) {
                        archive_set_error(&a->archive, errno,
                            "File size could not be restored");
                        return (ARCHIVE_FAILED);
                }
+#endif
                /*
                 * Explicitly stat the file as some platforms might not
                 * implement the XSI option to extend files via ftruncate.
index 5f2d5bcc72f9d793c12f7e5d49e9e119fa2a631e..12a3ca5895098ccdd858581c2ba6f7440704a40a 100644 (file)
@@ -22,7 +22,7 @@
  * (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: src/lib/libarchive/config_freebsd.h,v 1.11 2008/07/05 01:50:07 kientzle Exp $
+ * $FreeBSD: src/lib/libarchive/config_freebsd.h,v 1.13 2008/09/12 04:08:11 kientzle Exp $
  */
 
 /* FreeBSD 5.0 and later have ACL support. */
@@ -41,6 +41,7 @@
 #define        HAVE_DECL_INT64_MAX 1
 #define        HAVE_DECL_INT64_MIN 1
 #define        HAVE_DECL_SIZE_MAX 1
+#define        HAVE_DECL_SSIZE_MAX 1
 #define        HAVE_DECL_STRERROR_R 1
 #define        HAVE_DECL_UINT32_MAX 1
 #define        HAVE_DECL_UINT64_MAX 1
@@ -55,6 +56,7 @@
 #define        HAVE_FCNTL_H 1
 #define        HAVE_FSEEKO 1
 #define        HAVE_FSTAT 1
+#define        HAVE_FTRUNCATE 1
 #define        HAVE_FUTIMES 1
 #define        HAVE_GETEUID 1
 #define        HAVE_GETPID 1
@@ -86,6 +88,7 @@
 #define        HAVE_STRINGS_H 1
 #define        HAVE_STRING_H 1
 #define        HAVE_STRRCHR 1
+#define        HAVE_STRUCT_STAT_ST_BLKSIZE 1
 #define        HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1
 #define        HAVE_SYS_ACL_H 1
 #define        HAVE_SYS_IOCTL_H 1