archive_util.c (303975) | archive_util.c (305313) |
---|---|
1/*- 2 * Copyright (c) 2009-2012,2014 Michihiro NAKAJIMA 3 * Copyright (c) 2003-2007 Tim Kientzle 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include "archive_platform.h" | 1/*- 2 * Copyright (c) 2009-2012,2014 Michihiro NAKAJIMA 3 * Copyright (c) 2003-2007 Tim Kientzle 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include "archive_platform.h" |
28__FBSDID("$FreeBSD: releng/11.0/contrib/libarchive/libarchive/archive_util.c 299529 2016-05-12 10:16:16Z mm $"); | 28__FBSDID("$FreeBSD: releng/11.0/contrib/libarchive/libarchive/archive_util.c 305313 2016-09-03 00:27:41Z mm $"); |
29 30#ifdef HAVE_SYS_TYPES_H 31#include <sys/types.h> 32#endif 33#ifdef HAVE_ERRNO_H 34#include <errno.h> 35#endif 36#ifdef HAVE_FCNTL_H --- 538 unchanged lines hidden (view full) --- 575 * descriptor even if the platform seemingly provides O_CLOEXEC or 576 * F_DUPFD_CLOEXEC macros because it is possible that the platform 577 * merely declares those macros, especially Linux 2.6.18 - 2.6.24 do it. 578 */ 579void 580__archive_ensure_cloexec_flag(int fd) 581{ 582#if defined(_WIN32) && !defined(__CYGWIN__) | 29 30#ifdef HAVE_SYS_TYPES_H 31#include <sys/types.h> 32#endif 33#ifdef HAVE_ERRNO_H 34#include <errno.h> 35#endif 36#ifdef HAVE_FCNTL_H --- 538 unchanged lines hidden (view full) --- 575 * descriptor even if the platform seemingly provides O_CLOEXEC or 576 * F_DUPFD_CLOEXEC macros because it is possible that the platform 577 * merely declares those macros, especially Linux 2.6.18 - 2.6.24 do it. 578 */ 579void 580__archive_ensure_cloexec_flag(int fd) 581{ 582#if defined(_WIN32) && !defined(__CYGWIN__) |
583 (void)fd; /* UNSED */ | 583 (void)fd; /* UNUSED */ |
584#else 585 int flags; 586 587 if (fd >= 0) { 588 flags = fcntl(fd, F_GETFD); 589 if (flags != -1 && (flags & FD_CLOEXEC) == 0) 590 fcntl(fd, F_SETFD, flags | FD_CLOEXEC); 591 } --- 76 unchanged lines hidden --- | 584#else 585 int flags; 586 587 if (fd >= 0) { 588 flags = fcntl(fd, F_GETFD); 589 if (flags != -1 && (flags & FD_CLOEXEC) == 0) 590 fcntl(fd, F_SETFD, flags | FD_CLOEXEC); 591 } --- 76 unchanged lines hidden --- |