]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
More fixes from FreeBSD, thanks to Martin Matuska.
authorTim Kientzle <kientzle@gmail.com>
Sat, 24 Dec 2011 03:50:11 +0000 (22:50 -0500)
committerTim Kientzle <kientzle@gmail.com>
Sat, 24 Dec 2011 03:50:11 +0000 (22:50 -0500)
SVN-Revision: 3978

cpio/bsdcpio.1
cpio/cmdline.c
cpio/cpio.c
cpio/cpio.h

index 79b6997ef4a8e71da71a30125b29a95c06d6c528..789ce74e1c484fd60ee0cb2c5783409441f638dd 100644 (file)
@@ -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.
index 2223798c124daa93d29f1d8fb7871a31c924f214..ada549953ddf909ffadd2050888e26062858bf2f 100644 (file)
@@ -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.
  *
index 7d5031bbcd8fc7477048947e717416547133ea93..29f405c091eeb5c04b1b54dedb2aae06ffc55b02 100644 (file)
@@ -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.
index 3eed83494b8eafbf013ea1fcc28b700dc4206581..a86e924a7a77076abb66370d1382c5fbb31f6c42 100644 (file)
@@ -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. */