From 4c63d2152434d7a24cd627ef559f93b096274076 Mon Sep 17 00:00:00 2001 From: Apple Date: Tue, 11 Mar 2014 19:44:14 +0000 Subject: [PATCH] Libc-997.90.3.tar.gz --- include/inttypes.h | 111 ++++++++++++++++++++++++------------------- secure/chk_fail.c | 3 -- secure/memcpy_chk.c | 2 +- secure/secure.h | 2 +- secure/stpcpy_chk.c | 2 +- secure/stpncpy_chk.c | 2 +- secure/strcat_chk.c | 2 +- secure/strcpy_chk.c | 2 +- secure/strncat_chk.c | 2 +- secure/strncpy_chk.c | 2 +- util/mkpath_np.c | 8 ++++ 11 files changed, 77 insertions(+), 61 deletions(-) diff --git a/include/inttypes.h b/include/inttypes.h index 5e42c17..c29873d 100644 --- a/include/inttypes.h +++ b/include/inttypes.h @@ -1,23 +1,23 @@ /* - * Copyright (c) 2000, 2001, 2002, 2003, 2004 Apple Computer, Inc. - * All rights reserved. + * Copyright (c) 2000-2004, 2013 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ - * - * The contents of this file constitute Original Code as defined in and - * are subject to the Apple Public Source License Version 1.1 (the - * "License"). You may not use this file except in compliance with the - * License. Please obtain a copy of the License at - * http://www.apple.com/publicsource and read it before using this file. - * - * This Original Code and all software distributed under the License are - * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the - * License for the specific language governing rights and limitations - * under the License. - * + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * * @APPLE_LICENSE_HEADER_END@ */ @@ -220,40 +220,56 @@ # define SCNuMAX __SCN_MAX_LENGTH_MODIFIER__ "u" # define SCNxMAX __SCN_MAX_LENGTH_MODIFIER__ "x" -#include /* For __BEGIN_DECLS and __END_DECLS */ -#include <_types.h> /* For __darwin_wchar_t */ -#include - -#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) - /* Translator is not ISO/IEC 9899:1999-compliant. */ -# if !defined(restrict) -# define restrict -# define __RESTRICT_KEYWORD_DEFINED__ -# endif -#endif - -__BEGIN_DECLS - - /* 7.8.2.1 */ - extern intmax_t imaxabs(intmax_t j); - - /* 7.8.2.2 */ - typedef struct { - intmax_t quot; - intmax_t rem; - } imaxdiv_t; +#include +#include - extern imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom); +#include <_types.h> +#include - /* 7.8.2.3 */ - extern intmax_t strtoimax(const char * restrict nptr, char ** restrict endptr, int base); - extern uintmax_t strtoumax(const char * restrict nptr, char ** restrict endptr, int base); +#include -#include +__BEGIN_DECLS - /* 7.8.2.4 */ - extern intmax_t wcstoimax(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base); - extern uintmax_t wcstoumax(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base); +/* 7.8.2.1 */ +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +extern intmax_t +imaxabs(intmax_t j); + +/* 7.8.2.2 */ +typedef struct { + intmax_t quot; + intmax_t rem; +} imaxdiv_t; + +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +extern imaxdiv_t +imaxdiv(intmax_t __numer, intmax_t __denom); + +/* 7.8.2.3 */ +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +extern intmax_t +strtoimax(const char * __restrict __nptr, + char ** __restrict __endptr, + int __base); + +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +extern uintmax_t +strtoumax(const char * __restrict __nptr, + char ** __restrict __endptr, + int __base); + +/* 7.8.2.4 */ +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +extern intmax_t +wcstoimax(const wchar_t * __restrict __nptr, + wchar_t ** __restrict __endptr, + int __base); + +__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0) +extern uintmax_t +wcstoumax(const wchar_t * __restrict __nptr, + wchar_t ** __restrict __endptr, + int __base); /* Poison the following routines if -fshort-wchar is set */ #if !defined(__cplusplus) && defined(__WCHAR_MAX__) && __WCHAR_MAX__ <= 0xffffU @@ -278,9 +294,4 @@ __END_DECLS not where it is #defined. */ -#if defined(__RESTRICT_KEYWORD_DEFINED__) -# undef restrict -# undef __RESTRICT_KEYWORD_DEFINED__ -#endif - #endif /* !_INTTYPES_H_ */ diff --git a/secure/chk_fail.c b/secure/chk_fail.c index 8273211..29401b8 100644 --- a/secure/chk_fail.c +++ b/secure/chk_fail.c @@ -28,6 +28,3 @@ #include #include -__attribute__ ((visibility ("hidden"))) -int __chk_assert_no_overlap = 1; - diff --git a/secure/memcpy_chk.c b/secure/memcpy_chk.c index bb286fa..fcc5622 100644 --- a/secure/memcpy_chk.c +++ b/secure/memcpy_chk.c @@ -33,7 +33,7 @@ __memcpy_chk (void *dest, const void *src, size_t len, size_t dstlen) /* On OS X, memcpy has supported overlapping buffers for many years. * While technically, this will catch buggy code, we should not abort. - * if (__chk_assert_no_overlap) + * if (__builtin_expect (__chk_assert_no_overlap != 0, 1)) * __chk_overlap(dest, len, src, len); */ diff --git a/secure/secure.h b/secure/secure.h index 07bafc6..669b343 100644 --- a/secure/secure.h +++ b/secure/secure.h @@ -34,6 +34,6 @@ extern void __chk_fail_overlap (void) __attribute__((__noreturn__)); extern void __chk_overlap (const void *a, size_t an, const void *b, size_t bn); /* Do we avoid the overlap check for older APIs? */ -extern int __chk_assert_no_overlap; +extern uint32_t __chk_assert_no_overlap; #endif diff --git a/secure/stpcpy_chk.c b/secure/stpcpy_chk.c index ad09eca..c452721 100644 --- a/secure/stpcpy_chk.c +++ b/secure/stpcpy_chk.c @@ -34,7 +34,7 @@ __stpcpy_chk (char *dest, const char *src, size_t dstlen) if (__builtin_expect (dstlen < len, 0)) __chk_fail_overflow (); - if (__builtin_expect (__chk_assert_no_overlap, 1)) + if (__builtin_expect (__chk_assert_no_overlap != 0, 1)) __chk_overlap(dest, len, src, len); return retval; diff --git a/secure/stpncpy_chk.c b/secure/stpncpy_chk.c index a440551..5ad321f 100644 --- a/secure/stpncpy_chk.c +++ b/secure/stpncpy_chk.c @@ -42,7 +42,7 @@ __stpncpy_chk (char *restrict dest, char *restrict src, if (n == len + 1) n--; - if (__builtin_expect (__chk_assert_no_overlap, 1)) + if (__builtin_expect (__chk_assert_no_overlap != 0, 1)) __chk_overlap(dest, n, src, n); return retval; diff --git a/secure/strcat_chk.c b/secure/strcat_chk.c index c6be25c..7445ab3 100644 --- a/secure/strcat_chk.c +++ b/secure/strcat_chk.c @@ -36,7 +36,7 @@ __strcat_chk (char *__restrict dest, const char *__restrict append, if (__builtin_expect (dstlen < len1 + len2 + 1, 0)) __chk_fail_overflow (); - if (__builtin_expect (__chk_assert_no_overlap, 1)) + if (__builtin_expect (__chk_assert_no_overlap != 0, 1)) __chk_overlap(dest, len1 + len2 + 1, append, len2 + 1); memcpy(dest + len1, append, len2 + 1); diff --git a/secure/strcpy_chk.c b/secure/strcpy_chk.c index 71872e1..9b15f22 100644 --- a/secure/strcpy_chk.c +++ b/secure/strcpy_chk.c @@ -34,7 +34,7 @@ __strcpy_chk (char *restrict dest, char *restrict src, size_t dstlen) if (__builtin_expect (dstlen < len, 0)) __chk_fail_overflow (); - if (__builtin_expect (__chk_assert_no_overlap, 1)) + if (__builtin_expect (__chk_assert_no_overlap != 0, 1)) __chk_overlap(dest, len, src, len); return dest; diff --git a/secure/strncat_chk.c b/secure/strncat_chk.c index e1865d0..184023c 100644 --- a/secure/strncat_chk.c +++ b/secure/strncat_chk.c @@ -35,7 +35,7 @@ __strncat_chk (char *restrict dest, const char *restrict append, if (__builtin_expect (dstlen < len1 + len2 + 1, 0)) __chk_fail_overflow (); - if (__builtin_expect (__chk_assert_no_overlap, 1)) + if (__builtin_expect (__chk_assert_no_overlap != 0, 1)) __chk_overlap(dest, len1 + len2 + 1, append, len2 + 1); /* memmove() all but the NUL, since it might not actually be NUL */ diff --git a/secure/strncpy_chk.c b/secure/strncpy_chk.c index fb2e6f0..e8f7005 100644 --- a/secure/strncpy_chk.c +++ b/secure/strncpy_chk.c @@ -41,7 +41,7 @@ __strncpy_chk (char *restrict dest, char *restrict src, if (n == len + 1) n--; - if (__builtin_expect (__chk_assert_no_overlap, 1)) + if (__builtin_expect (__chk_assert_no_overlap != 0, 1)) __chk_overlap(dest, n, src, n); return dest; diff --git a/util/mkpath_np.c b/util/mkpath_np.c index 77a1853..fb02297 100644 --- a/util/mkpath_np.c +++ b/util/mkpath_np.c @@ -106,6 +106,14 @@ _mkpath_np(const char *path, mode_t omode, const char ** firstdir) } } + /* Retry the trivial case after having stripped of trailing /. */ + if (0 == mkdir(path, omode)) { + if (firstdir) { + *firstdir = strdup(path); + } + goto mkpath_exit; + } + while (1) { /* Increase our depth and try making that directory */ s = strrchr(apath, '/'); -- 2.45.2