aboutsummaryrefslogtreecommitdiffstats
path: root/cpio/cpio.c
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2011-12-26 22:25:58 +0000
committerMartin Matuska <mm@FreeBSD.org>2011-12-26 22:25:58 +0000
commit7691a6970b48b047c4290c0837e91dcab450db90 (patch)
tree15e9d164982e84a4b77c51d3cea2c450f6ec4ad1 /cpio/cpio.c
parent4b16b4e80ed599fbac3f6e4427cd9fbb43d1ea1a (diff)
downloadsrc-7691a6970b48b047c4290c0837e91dcab450db90.tar.gz
src-7691a6970b48b047c4290c0837e91dcab450db90.zip
Update to vendor revision 3982
Notes
Notes: svn path=/vendor/libarchive/dist/; revision=228905
Diffstat (limited to 'cpio/cpio.c')
-rw-r--r--cpio/cpio.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/cpio/cpio.c b/cpio/cpio.c
index 7d5031bbcd8f..29f405c091ee 100644
--- a/cpio/cpio.c
+++ b/cpio/cpio.c
@@ -273,15 +273,21 @@ main(int argc, char *argv[])
cpio->quiet = 1;
break;
case 'R': /* GNU cpio, also --owner */
+ /* TODO: owner_parse should return uname/gname
+ * also; use that to set [ug]name_override. */
errmsg = owner_parse(cpio->optarg, &uid, &gid);
if (errmsg) {
lafe_warnc(-1, "%s", errmsg);
usage();
}
- if (uid != -1)
+ if (uid != -1) {
cpio->uid_override = uid;
- if (gid != -1)
+ cpio->uname_override = NULL;
+ }
+ if (gid != -1) {
cpio->gid_override = gid;
+ cpio->gname_override = NULL;
+ }
break;
case 'r': /* POSIX 1997 */
cpio->option_rename = 1;
@@ -575,10 +581,14 @@ file_to_archive(struct cpio *cpio, const char *srcpath)
return (r);
}
- if (cpio->uid_override >= 0)
+ if (cpio->uid_override >= 0) {
archive_entry_set_uid(entry, cpio->uid_override);
- if (cpio->gid_override >= 0)
+ archive_entry_set_uname(entry, cpio->uname_override);
+ }
+ if (cpio->gid_override >= 0) {
archive_entry_set_gid(entry, cpio->gid_override);
+ archive_entry_set_gname(entry, cpio->gname_override);
+ }
/*
* Generate a destination path for this entry.