summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/archive_entry.c
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2004-04-12 01:16:16 +0000
committerkientzle <kientzle@FreeBSD.org>2004-04-12 01:16:16 +0000
commit444807bb419cc1185bb2d531a75682c02d185fc1 (patch)
tree620d152a72f7229f537f8ea04ba7d296fe1e368b /lib/libarchive/archive_entry.c
parentcd3b6fa4ace48070f152d7849f93feae16e76cdd (diff)
downloadFreeBSD-src-444807bb419cc1185bb2d531a75682c02d185fc1.zip
FreeBSD-src-444807bb419cc1185bb2d531a75682c02d185fc1.tar.gz
More work on ACLs: fix error in archive_entry's ACL parsing code,
try to set ACLs even if fflag restore fails, first cut at reading Solaris tar ACLs Code improvement: merge gnu tar read support into main tar reader; this eliminates a lot of duplicate code and generalizes the tar reader to handle formats with GNU-like extensions. Style: Makefile cleanup, eliminate 'dmalloc' references, remove 'tartype' from archive_entry (this makes archive_entry more format-agnostic) Thanks to: David Magda for providing Solaris tar test files
Diffstat (limited to 'lib/libarchive/archive_entry.c')
-rw-r--r--lib/libarchive/archive_entry.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/lib/libarchive/archive_entry.c b/lib/libarchive/archive_entry.c
index 6ddbd95..be261f5 100644
--- a/lib/libarchive/archive_entry.c
+++ b/lib/libarchive/archive_entry.c
@@ -29,9 +29,6 @@ __FBSDID("$FreeBSD$");
#include <sys/stat.h>
#include <sys/types.h>
-#ifdef HAVE_DMALLOC
-#include <dmalloc.h>
-#endif
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
@@ -119,9 +116,6 @@ struct archive_entry {
*/
struct stat ae_stat;
- /* I'm not happy with having this format-particular data here. */
- int ae_tartype;
-
/*
* Use aes here so that we get transparent mbs<->wcs conversions.
*/
@@ -283,7 +277,6 @@ archive_entry_clear(struct archive_entry *entry)
aes_clean(&entry->ae_uname);
archive_entry_acl_clear(entry);
memset(entry, 0, sizeof(*entry));
- entry->ae_tartype = -1;
return entry;
}
@@ -298,7 +291,6 @@ archive_entry_clone(struct archive_entry *entry)
return (NULL);
memset(entry2, 0, sizeof(*entry2));
entry2->ae_stat = entry->ae_stat;
- entry2->ae_tartype = entry->ae_tartype;
aes_copy(&entry2->ae_fflags ,&entry->ae_fflags);
aes_copy(&entry2->ae_gname ,&entry->ae_gname);
@@ -326,7 +318,6 @@ archive_entry_new(void)
if(entry == NULL)
return (NULL);
memset(entry, 0, sizeof(*entry));
- entry->ae_tartype = -1;
return (entry);
}
@@ -415,12 +406,6 @@ archive_entry_symlink(struct archive_entry *entry)
return (aes_get_mbs(&entry->ae_symlink));
}
-int
-archive_entry_tartype(struct archive_entry *entry)
-{
- return (entry->ae_tartype);
-}
-
const char *
archive_entry_uname(struct archive_entry *entry)
{
@@ -501,6 +486,16 @@ archive_entry_copy_hardlink_w(struct archive_entry *entry, const wchar_t *target
aes_copy_wcs(&entry->ae_hardlink, target);
}
+/* Set symlink if symlink is already set, else set hardlink. */
+void
+archive_entry_set_link(struct archive_entry *entry, const char *target)
+{
+ if (entry->ae_symlink.aes_mbs != NULL ||
+ entry->ae_symlink.aes_wcs != NULL)
+ aes_set_mbs(&entry->ae_symlink, target);
+ aes_set_mbs(&entry->ae_hardlink, target);
+}
+
void
archive_entry_set_mode(struct archive_entry *entry, mode_t m)
{
@@ -538,12 +533,6 @@ archive_entry_copy_symlink_w(struct archive_entry *entry, const wchar_t *linknam
}
void
-archive_entry_set_tartype(struct archive_entry *entry, char t)
-{
- entry->ae_tartype = t;
-}
-
-void
archive_entry_set_uid(struct archive_entry *entry, uid_t u)
{
entry->ae_stat.st_uid = u;
@@ -1121,15 +1110,16 @@ __archive_entry_acl_parse_w(struct archive_entry *entry,
namebuff =
malloc(namebuff_length * sizeof(wchar_t));
}
- wmemcpy(namebuff, start, end-start);
+ wmemcpy(namebuff, name_start, name_end - name_start);
archive_entry_acl_add_entry_w(entry, type,
permset, tag, id, namebuff);
}
}
+ if (namebuff != NULL)
+ free(namebuff);
return (ARCHIVE_OK);
fail:
- fprintf(stderr, "ACL error\n");
if (namebuff != NULL)
free(namebuff);
return (ARCHIVE_WARN);
OpenPOWER on IntegriCloud