summaryrefslogtreecommitdiffstats
path: root/Utilities/cmlibarchive/libarchive/archive_string_sprintf.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-07-26 20:08:54 (GMT)
committerBrad King <brad.king@kitware.com>2013-07-31 12:19:13 (GMT)
commit102071f80cf4ad7aa97bf8a1618cfc6ee6689ab6 (patch)
treedb05ed527f04506957049a7b087be6c038d98435 /Utilities/cmlibarchive/libarchive/archive_string_sprintf.c
parent87402c995ed2460deb2f39e02acf77a0bb57f263 (diff)
parent35df7c8ba8854e97bd6994c4d1143f57535ed6f2 (diff)
downloadCMake-102071f80cf4ad7aa97bf8a1618cfc6ee6689ab6.zip
CMake-102071f80cf4ad7aa97bf8a1618cfc6ee6689ab6.tar.gz
CMake-102071f80cf4ad7aa97bf8a1618cfc6ee6689ab6.tar.bz2
Merge branch 'libarchive-upstream' into update-libarchive
Conflicts: Utilities/cmlibarchive/CMakeLists.txt Utilities/cmlibarchive/libarchive/archive.h Utilities/cmlibarchive/libarchive/archive_entry.h Utilities/cmlibarchive/libarchive/archive_read_disk_posix.c Utilities/cmlibarchive/libarchive/archive_read_support_format_iso9660.c Utilities/cmlibarchive/libarchive/archive_windows.h Utilities/cmlibarchive/libarchive/archive_write_set_format_iso9660.c
Diffstat (limited to 'Utilities/cmlibarchive/libarchive/archive_string_sprintf.c')
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_string_sprintf.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/Utilities/cmlibarchive/libarchive/archive_string_sprintf.c b/Utilities/cmlibarchive/libarchive/archive_string_sprintf.c
index 7d7d971..964ea2b 100644
--- a/Utilities/cmlibarchive/libarchive/archive_string_sprintf.c
+++ b/Utilities/cmlibarchive/libarchive/archive_string_sprintf.c
@@ -38,7 +38,9 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_string_sprintf.c 189435 2009-03-
* here. This is only used to format error messages, so doesn't
* require any floating-point support or field-width handling.
*/
-
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
#include <stdio.h>
#include "archive_string.h"
@@ -129,7 +131,7 @@ archive_string_vsprintf(struct archive_string *as, const char *fmt,
break;
case 'c':
s = va_arg(ap, int);
- archive_strappend_char(as, s);
+ archive_strappend_char(as, (char)s);
break;
case 'd':
switch(long_flag) {
@@ -146,7 +148,9 @@ archive_string_vsprintf(struct archive_string *as, const char *fmt,
pw = va_arg(ap, wchar_t *);
if (pw == NULL)
pw = L"(null)";
- archive_string_append_from_wcs(as, pw, wcslen(pw));
+ if (archive_string_append_from_wcs(as, pw,
+ wcslen(pw)) != 0 && errno == ENOMEM)
+ __archive_errx(1, "Out of memory");
break;
default:
p2 = va_arg(ap, char *);
@@ -160,7 +164,9 @@ archive_string_vsprintf(struct archive_string *as, const char *fmt,
pw = va_arg(ap, wchar_t *);
if (pw == NULL)
pw = L"(null)";
- archive_string_append_from_wcs(as, pw, wcslen(pw));
+ if (archive_string_append_from_wcs(as, pw,
+ wcslen(pw)) != 0 && errno == ENOMEM)
+ __archive_errx(1, "Out of memory");
break;
case 'o': case 'u': case 'x': case 'X':
/* Common handling for unsigned integer formats. */