From owner-svn-src-head@FreeBSD.ORG Mon Dec 28 02:28:45 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F3C5D106566B; Mon, 28 Dec 2009 02:28:44 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C9AFB8FC08; Mon, 28 Dec 2009 02:28:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBS2Sitn075909; Mon, 28 Dec 2009 02:28:44 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBS2SiNx075905; Mon, 28 Dec 2009 02:28:44 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200912280228.nBS2SiNx075905@svn.freebsd.org> From: Tim Kientzle Date: Mon, 28 Dec 2009 02:28:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201093 - head/lib/libarchive X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2009 02:28:45 -0000 Author: kientzle Date: Mon Dec 28 02:28:44 2009 New Revision: 201093 URL: http://svn.freebsd.org/changeset/base/201093 Log: Portability: Set the file descriptor to binary mode on Win32 Modified: head/lib/libarchive/archive_read_open_file.c head/lib/libarchive/archive_read_open_filename.c head/lib/libarchive/archive_write_open_fd.c Modified: head/lib/libarchive/archive_read_open_file.c ============================================================================== --- head/lib/libarchive/archive_read_open_file.c Mon Dec 28 02:26:06 2009 (r201092) +++ head/lib/libarchive/archive_read_open_file.c Mon Dec 28 02:28:44 2009 (r201093) @@ -35,6 +35,9 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_FCNTL_H #include #endif +#ifdef HAVE_IO_H +#include +#endif #ifdef HAVE_STDLIB_H #include #endif @@ -94,6 +97,10 @@ archive_read_open_FILE(struct archive *a } else mine->can_skip = 0; +#if defined(__CYGWIN__) || defined(_WIN32) + setmode(fileno(mine->f), O_BINARY); +#endif + return (archive_read_open2(a, mine, NULL, file_read, file_skip, file_close)); } Modified: head/lib/libarchive/archive_read_open_filename.c ============================================================================== --- head/lib/libarchive/archive_read_open_filename.c Mon Dec 28 02:26:06 2009 (r201092) +++ head/lib/libarchive/archive_read_open_filename.c Mon Dec 28 02:28:44 2009 (r201093) @@ -35,6 +35,9 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_FCNTL_H #include #endif +#ifdef HAVE_IO_H +#include +#endif #ifdef HAVE_STDLIB_H #include #endif @@ -96,6 +99,9 @@ archive_read_open_filename(struct archiv */ filename = ""; /* Normalize NULL to "" */ fd = 0; +#if defined(__CYGWIN__) || defined(_WIN32) + setmode(0, O_BINARY); +#endif } else { fd = open(filename, O_RDONLY | O_BINARY); if (fd < 0) { Modified: head/lib/libarchive/archive_write_open_fd.c ============================================================================== --- head/lib/libarchive/archive_write_open_fd.c Mon Dec 28 02:26:06 2009 (r201092) +++ head/lib/libarchive/archive_write_open_fd.c Mon Dec 28 02:28:44 2009 (r201093) @@ -32,6 +32,12 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include #endif +#ifdef HAVE_FCNTL_H +#include +#endif +#ifdef HAVE_IO_H +#include +#endif #ifdef HAVE_STDLIB_H #include #endif @@ -64,6 +70,9 @@ archive_write_open_fd(struct archive *a, return (ARCHIVE_FATAL); } mine->fd = fd; +#if defined(__CYGWIN__) || defined(_WIN32) + setmode(mine->fd, O_BINARY); +#endif return (archive_write_open(a, mine, file_open, file_write, file_close)); }