summaryrefslogtreecommitdiffstats
path: root/libarchive/archive_string_sprintf.c
diff options
context:
space:
mode:
authorLibArchive Upstream <libarchive-discuss@googlegroups.com>2013-02-09 17:17:57 (GMT)
committerBrad King <brad.king@kitware.com>2013-07-26 19:45:29 (GMT)
commit35df7c8ba8854e97bd6994c4d1143f57535ed6f2 (patch)
tree53b9fc3871ba5fc74dcea98173cd05311704ddfc /libarchive/archive_string_sprintf.c
parent4f4fe6e50bb3dbe59f9bc3cc848cbd07dead324d (diff)
downloadCMake-35df7c8ba8854e97bd6994c4d1143f57535ed6f2.zip
CMake-35df7c8ba8854e97bd6994c4d1143f57535ed6f2.tar.gz
CMake-35df7c8ba8854e97bd6994c4d1143f57535ed6f2.tar.bz2
libarchive 3.1.2 (reduced)
Extract upstream libarchive using the following shell code. url=git://github.com/libarchive/libarchive.git && v=3.1.2 && r=19f23e19 && paths=" CMakeLists.txt COPYING CTestConfig.cmake build/cmake build/pkgconfig build/utils build/version libarchive/*.* " && mkdir libarchive-$v-g$r-reduced && git clone $url libarchive-git && date=$(cd libarchive-git && git log -n 1 --format='%cd' $r) && (cd libarchive-git && git archive --format=tar $r -- $paths) | (cd libarchive-$v-g$r-reduced && tar xv) && fromdos libarchive-$v-g$r-reduced/build/cmake/Find*.cmake && echo "g$r date: $date"
Diffstat (limited to 'libarchive/archive_string_sprintf.c')
-rw-r--r--libarchive/archive_string_sprintf.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/libarchive/archive_string_sprintf.c b/libarchive/archive_string_sprintf.c
index 7d7d971..964ea2b 100644
--- a/libarchive/archive_string_sprintf.c
+++ b/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. */