summaryrefslogtreecommitdiffstats
path: root/libarchive/archive_entry.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_entry.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_entry.c')
-rw-r--r--libarchive/archive_entry.c81
1 files changed, 71 insertions, 10 deletions
diff --git a/libarchive/archive_entry.c b/libarchive/archive_entry.c
index cbdda8a..386e51d 100644
--- a/libarchive/archive_entry.c
+++ b/libarchive/archive_entry.c
@@ -375,8 +375,11 @@ archive_entry_fflags_text(struct archive_entry *entry)
char *p;
if (archive_mstring_get_mbs(entry->archive,
- &entry->ae_fflags_text, &f) == 0 && f != NULL)
- return (f);
+ &entry->ae_fflags_text, &f) == 0) {
+ if (f != NULL)
+ return (f);
+ } else if (errno == ENOMEM)
+ __archive_errx(1, "No memory");
if (entry->ae_fflags_set == 0 && entry->ae_fflags_clear == 0)
return (NULL);
@@ -390,6 +393,8 @@ archive_entry_fflags_text(struct archive_entry *entry)
if (archive_mstring_get_mbs(entry->archive,
&entry->ae_fflags_text, &f) == 0)
return (f);
+ if (errno == ENOMEM)
+ __archive_errx(1, "No memory");
return (NULL);
}
@@ -405,6 +410,8 @@ archive_entry_gname(struct archive_entry *entry)
const char *p;
if (archive_mstring_get_mbs(entry->archive, &entry->ae_gname, &p) == 0)
return (p);
+ if (errno == ENOMEM)
+ __archive_errx(1, "No memory");
return (NULL);
}
@@ -414,6 +421,8 @@ archive_entry_gname_w(struct archive_entry *entry)
const wchar_t *p;
if (archive_mstring_get_wcs(entry->archive, &entry->ae_gname, &p) == 0)
return (p);
+ if (errno == ENOMEM)
+ __archive_errx(1, "No memory");
return (NULL);
}
@@ -428,9 +437,13 @@ const char *
archive_entry_hardlink(struct archive_entry *entry)
{
const char *p;
- if ((entry->ae_set & AE_SET_HARDLINK) && archive_mstring_get_mbs(
+ if ((entry->ae_set & AE_SET_HARDLINK) == 0)
+ return (NULL);
+ if (archive_mstring_get_mbs(
entry->archive, &entry->ae_hardlink, &p) == 0)
return (p);
+ if (errno == ENOMEM)
+ __archive_errx(1, "No memory");
return (NULL);
}
@@ -438,9 +451,13 @@ const wchar_t *
archive_entry_hardlink_w(struct archive_entry *entry)
{
const wchar_t *p;
- if ((entry->ae_set & AE_SET_HARDLINK) && archive_mstring_get_wcs(
+ if ((entry->ae_set & AE_SET_HARDLINK) == 0)
+ return (NULL);
+ if (archive_mstring_get_wcs(
entry->archive, &entry->ae_hardlink, &p) == 0)
return (p);
+ if (errno == ENOMEM)
+ __archive_errx(1, "No memory");
return (NULL);
}
@@ -511,6 +528,8 @@ archive_entry_pathname(struct archive_entry *entry)
if (archive_mstring_get_mbs(
entry->archive, &entry->ae_pathname, &p) == 0)
return (p);
+ if (errno == ENOMEM)
+ __archive_errx(1, "No memory");
return (NULL);
}
@@ -521,6 +540,8 @@ archive_entry_pathname_w(struct archive_entry *entry)
if (archive_mstring_get_wcs(
entry->archive, &entry->ae_pathname, &p) == 0)
return (p);
+ if (errno == ENOMEM)
+ __archive_errx(1, "No memory");
return (NULL);
}
@@ -584,6 +605,8 @@ archive_entry_sourcepath(struct archive_entry *entry)
if (archive_mstring_get_mbs(
entry->archive, &entry->ae_sourcepath, &p) == 0)
return (p);
+ if (errno == ENOMEM)
+ __archive_errx(1, "No memory");
return (NULL);
}
@@ -601,9 +624,13 @@ const char *
archive_entry_symlink(struct archive_entry *entry)
{
const char *p;
- if ((entry->ae_set & AE_SET_SYMLINK) && archive_mstring_get_mbs(
+ if ((entry->ae_set & AE_SET_SYMLINK) == 0)
+ return (NULL);
+ if (archive_mstring_get_mbs(
entry->archive, &entry->ae_symlink, &p) == 0)
return (p);
+ if (errno == ENOMEM)
+ __archive_errx(1, "No memory");
return (NULL);
}
@@ -611,9 +638,13 @@ const wchar_t *
archive_entry_symlink_w(struct archive_entry *entry)
{
const wchar_t *p;
- if ((entry->ae_set & AE_SET_SYMLINK) && archive_mstring_get_wcs(
+ if ((entry->ae_set & AE_SET_SYMLINK) == 0)
+ return (NULL);
+ if (archive_mstring_get_wcs(
entry->archive, &entry->ae_symlink, &p) == 0)
return (p);
+ if (errno == ENOMEM)
+ __archive_errx(1, "No memory");
return (NULL);
}
@@ -641,6 +672,8 @@ archive_entry_uname(struct archive_entry *entry)
const char *p;
if (archive_mstring_get_mbs(entry->archive, &entry->ae_uname, &p) == 0)
return (p);
+ if (errno == ENOMEM)
+ __archive_errx(1, "No memory");
return (NULL);
}
@@ -650,6 +683,8 @@ archive_entry_uname_w(struct archive_entry *entry)
const wchar_t *p;
if (archive_mstring_get_wcs(entry->archive, &entry->ae_uname, &p) == 0)
return (p);
+ if (errno == ENOMEM)
+ __archive_errx(1, "No memory");
return (NULL);
}
@@ -730,6 +765,8 @@ archive_entry_update_gname_utf8(struct archive_entry *entry, const char *name)
if (archive_mstring_update_utf8(entry->archive,
&entry->ae_gname, name) == 0)
return (1);
+ if (errno == ENOMEM)
+ __archive_errx(1, "No memory");
return (0);
}
@@ -796,6 +833,8 @@ archive_entry_update_hardlink_utf8(struct archive_entry *entry, const char *targ
if (archive_mstring_update_utf8(entry->archive,
&entry->ae_hardlink, target) == 0)
return (1);
+ if (errno == ENOMEM)
+ __archive_errx(1, "No memory");
return (0);
}
@@ -932,7 +971,11 @@ archive_entry_update_link_utf8(struct archive_entry *entry, const char *target)
else
r = archive_mstring_update_utf8(entry->archive,
&entry->ae_hardlink, target);
- return ((r == 0)? 1: 0);
+ if (r == 0)
+ return (1);
+ if (errno == ENOMEM)
+ __archive_errx(1, "No memory");
+ return (0);
}
int
@@ -1005,6 +1048,8 @@ archive_entry_update_pathname_utf8(struct archive_entry *entry, const char *name
if (archive_mstring_update_utf8(entry->archive,
&entry->ae_pathname, name) == 0)
return (1);
+ if (errno == ENOMEM)
+ __archive_errx(1, "No memory");
return (0);
}
@@ -1115,6 +1160,8 @@ archive_entry_update_symlink_utf8(struct archive_entry *entry, const char *linkn
if (archive_mstring_update_utf8(entry->archive,
&entry->ae_symlink, linkname) == 0)
return (1);
+ if (errno == ENOMEM)
+ __archive_errx(1, "No memory");
return (0);
}
@@ -1164,6 +1211,8 @@ archive_entry_update_uname_utf8(struct archive_entry *entry, const char *name)
if (archive_mstring_update_utf8(entry->archive,
&entry->ae_uname, name) == 0)
return (1);
+ if (errno == ENOMEM)
+ __archive_errx(1, "No memory");
return (0);
}
@@ -1269,7 +1318,12 @@ int
archive_entry_acl_next(struct archive_entry *entry, int want_type, int *type,
int *permset, int *tag, int *id, const char **name)
{
- return archive_acl_next(entry->archive, &entry->acl, want_type, type, permset, tag, id, name);
+ int r;
+ r = archive_acl_next(entry->archive, &entry->acl, want_type, type,
+ permset, tag, id, name);
+ if (r == ARCHIVE_FATAL && errno == ENOMEM)
+ __archive_errx(1, "No memory");
+ return (r);
}
/*
@@ -1279,7 +1333,11 @@ archive_entry_acl_next(struct archive_entry *entry, int want_type, int *type,
const wchar_t *
archive_entry_acl_text_w(struct archive_entry *entry, int flags)
{
- return archive_acl_text_w(entry->archive, &entry->acl, flags);
+ const wchar_t *r;
+ r = archive_acl_text_w(entry->archive, &entry->acl, flags);
+ if (r == NULL && errno == ENOMEM)
+ __archive_errx(1, "No memory");
+ return (r);
}
const char *
@@ -1288,7 +1346,7 @@ archive_entry_acl_text(struct archive_entry *entry, int flags)
const char *p;
if (archive_acl_text_l(&entry->acl, flags, &p, NULL, NULL) != 0
&& errno == ENOMEM)
- return (NULL);
+ __archive_errx(1, "No memory");
return (p);
}
@@ -1391,6 +1449,9 @@ static struct flag {
{ "nouunlnk", L"nouunlnk", UF_NOUNLINK, 0 },
{ "nouunlink", L"nouunlink", UF_NOUNLINK, 0 },
#endif
+#ifdef UF_COMPRESSED
+ { "nocompressed",L"nocompressed", UF_COMPRESSED, 0 },
+#endif
#ifdef EXT2_UNRM_FL
{ "nouunlink", L"nouunlink", EXT2_UNRM_FL, 0},
#endif