summaryrefslogtreecommitdiffstats
path: root/contrib/libarchive
diff options
context:
space:
mode:
authormm <mm@FreeBSD.org>2011-12-21 15:33:13 +0000
committermm <mm@FreeBSD.org>2011-12-21 15:33:13 +0000
commitddda7a76813bc31bfd63d1553e8948e19dbd07c6 (patch)
tree7815a9ee26c51ae5b039c55d41a45e6b7acb66be /contrib/libarchive
parentb1c52fb62fd071ac23f9b80860f2e17360f6f896 (diff)
downloadFreeBSD-src-ddda7a76813bc31bfd63d1553e8948e19dbd07c6.zip
FreeBSD-src-ddda7a76813bc31bfd63d1553e8948e19dbd07c6.tar.gz
Merge FreeBSD changes from usr.bin/cpio to contrib/libarchive/cpio:
r204111 (uqs): Fix common misspelling of hierarchy r211054 (kientzle); Fix -R when used with -p. Previously, the uname and gname weren't overwritten, so the disk restore would use those to lookup the original uid/gid again. Clearing the uname and gname prevents this. r212263 (gjb): Fix typo in bsdcpio manual: s/libarchive_formats/libarchive-formats MFC after: 2 weeks
Diffstat (limited to 'contrib/libarchive')
-rw-r--r--contrib/libarchive/cpio/bsdcpio.16
-rw-r--r--contrib/libarchive/cpio/cmdline.c2
-rw-r--r--contrib/libarchive/cpio/cpio.c18
-rw-r--r--contrib/libarchive/cpio/cpio.h2
4 files changed, 21 insertions, 7 deletions
diff --git a/contrib/libarchive/cpio/bsdcpio.1 b/contrib/libarchive/cpio/bsdcpio.1
index 79b6997..789ce74 100644
--- a/contrib/libarchive/cpio/bsdcpio.1
+++ b/contrib/libarchive/cpio/bsdcpio.1
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd December 21, 2007
+.Dd September 5, 2010
.Dt BSDCPIO 1
.Os
.Sh NAME
@@ -140,7 +140,7 @@ The POSIX.1 tar format.
The default format is
.Ar odc .
See
-.Xr libarchive_formats 5
+.Xr libarchive-formats 5
for more complete information about the
formats currently supported by the underlying
.Xr libarchive 3
@@ -295,7 +295,7 @@ for more information.
.Sh EXAMPLES
The
.Nm
-command is traditionally used to copy file heirarchies in conjunction
+command is traditionally used to copy file hierarchies in conjunction
with the
.Xr find 1
command.
diff --git a/contrib/libarchive/cpio/cmdline.c b/contrib/libarchive/cpio/cmdline.c
index 3d4590f..687fa62 100644
--- a/contrib/libarchive/cpio/cmdline.c
+++ b/contrib/libarchive/cpio/cmdline.c
@@ -285,6 +285,8 @@ cpio_getopt(struct cpio *cpio)
* A period can be used instead of the colon.
*
* Sets uid/gid return as appropriate, -1 indicates uid/gid not specified.
+ * TODO: If the spec uses uname/gname, then return those to the caller
+ * as well. If the spec provides uid/gid, just return names as NULL.
*
* Returns NULL if no error, otherwise returns error string for display.
*
diff --git a/contrib/libarchive/cpio/cpio.c b/contrib/libarchive/cpio/cpio.c
index f72aee5..cd81050 100644
--- a/contrib/libarchive/cpio/cpio.c
+++ b/contrib/libarchive/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.
diff --git a/contrib/libarchive/cpio/cpio.h b/contrib/libarchive/cpio/cpio.h
index 879632f..2d5b548 100644
--- a/contrib/libarchive/cpio/cpio.h
+++ b/contrib/libarchive/cpio/cpio.h
@@ -68,7 +68,9 @@ struct cpio {
size_t pass_destpath_alloc;
char *pass_destpath;
int uid_override;
+ char *uname_override;
int gid_override;
+ char *gname_override;
int day_first; /* true if locale prefers day/mon */
/* If >= 0, then close this when done. */
OpenPOWER on IntegriCloud