summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/archive_write_set_format_pax.c
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2004-04-05 21:12:29 +0000
committerkientzle <kientzle@FreeBSD.org>2004-04-05 21:12:29 +0000
commit775d07093eb7dc5701457147a8404f0eae443538 (patch)
tree65c99eaf5f048beaa6a7d9973eb8410048b1f15d /lib/libarchive/archive_write_set_format_pax.c
parent74cf37bd00b1e09a0b991b7b1edd335d8e0c2355 (diff)
downloadFreeBSD-src-775d07093eb7dc5701457147a8404f0eae443538.zip
FreeBSD-src-775d07093eb7dc5701457147a8404f0eae443538.tar.gz
Overhauled ACL support. This makes us compatible
with 'star' ACL handling, though there's still a bit more work needed in this area. Added 'write_open_fd' and 'read_open_fd' to simplify, e.g., tar's u and r modes. Eliminated old 'write_open_file_position' as a bad idea. (It required closing/reopening files to do updates, which led to unpleasant implications.) Various other minor fixes, API tweaks, etc.
Diffstat (limited to 'lib/libarchive/archive_write_set_format_pax.c')
-rw-r--r--lib/libarchive/archive_write_set_format_pax.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/lib/libarchive/archive_write_set_format_pax.c b/lib/libarchive/archive_write_set_format_pax.c
index 441c190..d0cec2c 100644
--- a/lib/libarchive/archive_write_set_format_pax.c
+++ b/lib/libarchive/archive_write_set_format_pax.c
@@ -248,7 +248,7 @@ add_pax_attr_w(struct archive_string *as, const char *key, const wchar_t *wval)
p += 6;
}
}
-
+ *p = '\0';
add_pax_attr(as, key, utf8_value);
free(utf8_value);
}
@@ -488,6 +488,16 @@ archive_write_pax_header(struct archive *a,
if ((st_main->st_mtime < 0) || (st_main->st_mtime >= 0x7fffffff))
need_extension = 1;
+ /* If there are non-trivial ACL entries, we need an extension. */
+ if (archive_entry_acl_count(entry_original,
+ ARCHIVE_ENTRY_ACL_TYPE_ACCESS) > 0)
+ need_extension = 1;
+
+ /* If there are non-trivial ACL entries, we need an extension. */
+ if (archive_entry_acl_count(entry_original,
+ ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) > 0)
+ need_extension = 1;
+
/*
* The following items are handled differently in "pax
* restricted" format. In particular, in "pax restricted"
@@ -520,13 +530,15 @@ archive_write_pax_header(struct archive *a,
add_pax_attr(&(pax->pax_header), "SCHILY.fflags", p);
/* I use star-compatible ACL attributes. */
- p = archive_entry_acl(entry_main);
- if (p != NULL && *p != '\0')
- add_pax_attr(&(pax->pax_header), "SCHILY.acl.access", p);
- p = archive_entry_acl_default(entry_main);
- if (p != NULL && *p != '\0')
- add_pax_attr(&(pax->pax_header), "SCHILY.acl.default",
- p);
+ wp = __archive_entry_acl_text_w(entry_original,
+ ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
+ if (wp != NULL && *wp != L'\0')
+ add_pax_attr_w(&(pax->pax_header), "SCHILY.acl.access", wp);
+ wp = __archive_entry_acl_text_w(entry_original,
+ ARCHIVE_ENTRY_ACL_TYPE_DEFAULT);
+ if (wp != NULL && *wp != L'\0')
+ add_pax_attr_w(&(pax->pax_header), "SCHILY.acl.default",
+ wp);
/* Include star-compatible metadata info. */
add_pax_attr_int(&(pax->pax_header), "SCHILY.dev",
OpenPOWER on IntegriCloud