aboutsummaryrefslogtreecommitdiff
path: root/lib/libarchive/archive_write_set_format_pax.c
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@FreeBSD.org>2005-06-01 15:44:23 +0000
committerTim Kientzle <kientzle@FreeBSD.org>2005-06-01 15:44:23 +0000
commit3a2a859dd4bf151712758da09adfe88aa5b54347 (patch)
treea0265f8757a9cdf69f87dcceeb15a519dc097d2c /lib/libarchive/archive_write_set_format_pax.c
parent659e382f5b1c0c880aa5489a70870660d0937890 (diff)
downloadsrc-3a2a859dd4bf151712758da09adfe88aa5b54347.tar.gz
src-3a2a859dd4bf151712758da09adfe88aa5b54347.zip
A minor refinement to "pax" output: Remove suid/sgid/sticky bits
from mode before using mode for extended attributes entry, copy mtime/atime/ctime to extended attributes entry so it's a little more clear that it corresponds to the like-named regular entry. MFC after: 14 days
Notes
Notes: svn path=/head/; revision=146875
Diffstat (limited to 'lib/libarchive/archive_write_set_format_pax.c')
-rw-r--r--lib/libarchive/archive_write_set_format_pax.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/libarchive/archive_write_set_format_pax.c b/lib/libarchive/archive_write_set_format_pax.c
index 2309909e6bc9..479cca6206d5 100644
--- a/lib/libarchive/archive_write_set_format_pax.c
+++ b/lib/libarchive/archive_write_set_format_pax.c
@@ -643,19 +643,41 @@ archive_write_pax_header(struct archive *a,
archive_entry_set_pathname(pax_attr_entry,
build_pax_attribute_name(pax_entry_name, p));
st.st_size = archive_strlen(&(pax->pax_header));
+ /* Copy uid/gid (but clip to ustar limits). */
st.st_uid = st_main->st_uid;
if (st.st_uid >= 1 << 18)
st.st_uid = (1 << 18) - 1;
st.st_gid = st_main->st_gid;
if (st.st_gid >= 1 << 18)
st.st_gid = (1 << 18) - 1;
+ /* Copy mode over (but not setuid/setgid bits) */
st.st_mode = st_main->st_mode;
+#ifdef S_ISUID
+ st.st_mode &= ~S_ISUID;
+#endif
+#ifdef S_ISGID
+ st.st_mode &= ~S_ISGID;
+#endif
+#ifdef S_ISVTX
+ st.st_mode &= ~S_ISVTX;
+#endif
archive_entry_copy_stat(pax_attr_entry, &st);
+ /* Copy uname/gname. */
archive_entry_set_uname(pax_attr_entry,
archive_entry_uname(entry_main));
archive_entry_set_gname(pax_attr_entry,
archive_entry_gname(entry_main));
+ /* Copy timestamps. */
+ archive_entry_set_mtime(pax_attr_entry,
+ archive_entry_mtime(entry_main),
+ archive_entry_mtime_nsec(entry_main));
+ archive_entry_set_atime(pax_attr_entry,
+ archive_entry_atime(entry_main),
+ archive_entry_atime_nsec(entry_main));
+ archive_entry_set_ctime(pax_attr_entry,
+ archive_entry_ctime(entry_main),
+ archive_entry_ctime_nsec(entry_main));
ret = __archive_write_format_header_ustar(a, paxbuff,
pax_attr_entry, 'x', 1);