summaryrefslogtreecommitdiffstats
path: root/daemon
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-08-14 09:54:31 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-08-14 10:00:27 +0100
commit4dbae7cc06544fc1e9b622826f613bec84ec6d11 (patch)
tree47db65ad171962f0b30fb9f72dfb081218e29850 /daemon
parent864ef706a84c7c87a62f776d4b2e82a6f959ae14 (diff)
downloadlibguestfs-4dbae7cc06544fc1e9b622826f613bec84ec6d11.tar.gz
libguestfs-4dbae7cc06544fc1e9b622826f613bec84ec6d11.tar.xz
libguestfs-4dbae7cc06544fc1e9b622826f613bec84ec6d11.zip
tar-out: Add optional numericowner flag (RHBZ#847880).
This is equivalent to the tar option --numeric-owner.
Diffstat (limited to 'daemon')
-rw-r--r--daemon/tar.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/daemon/tar.c b/daemon/tar.c
index 8d78283e..f46733df 100644
--- a/daemon/tar.c
+++ b/daemon/tar.c
@@ -240,7 +240,7 @@ do_txz_in (const char *dir)
/* Has one FileOut parameter. */
/* Takes optional arguments, consult optargs_bitmask. */
int
-do_tar_out (const char *dir, const char *compress)
+do_tar_out (const char *dir, const char *compress, int numericowner)
{
const char *filter;
int r;
@@ -266,9 +266,13 @@ do_tar_out (const char *dir, const char *compress)
} else
filter = "";
+ if (!(optargs_bitmask & GUESTFS_TAR_OUT_NUMERICOWNER_BITMASK))
+ numericowner = 0;
+
/* "tar -C /sysroot%s -cf - ." but we have to quote the dir. */
- if (asprintf_nowarn (&cmd, "tar -C %R%s -cf - .",
- dir, filter) == -1) {
+ if (asprintf_nowarn (&cmd, "tar -C %R%s%s -cf - .",
+ dir, filter,
+ numericowner ? " --numeric-owner" : "") == -1) {
reply_with_perror ("asprintf");
return -1;
}
@@ -321,7 +325,7 @@ int
do_tgz_out (const char *dir)
{
optargs_bitmask = GUESTFS_TAR_OUT_COMPRESS_BITMASK;
- return do_tar_out (dir, "gzip");
+ return do_tar_out (dir, "gzip", 0);
}
/* Has one FileOut parameter. */
@@ -329,5 +333,5 @@ int
do_txz_out (const char *dir)
{
optargs_bitmask = GUESTFS_TAR_OUT_COMPRESS_BITMASK;
- return do_tar_out (dir, "bzip2");
+ return do_tar_out (dir, "bzip2", 0);
}