From 9ecb744f0ca6faca02cc7be7539802c040cd2922 Mon Sep 17 00:00:00 2001 From: Dmitry Rozhkov Date: Tue, 23 Feb 2016 15:01:25 +0200 Subject: [PATCH] Clean up tar commands: always put files after options Unify tar commands to have files enumerated always at the end of the commands. This would follow the scheme used in tar's man page and simplify adoption of other tar implementation should the need arise. Upstream-Status: Accepted Signed-off-by: Dmitry Rozhkov --- src/fullfiles.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fullfiles.c b/src/fullfiles.c index fa78293..23e95db 100644 --- a/src/fullfiles.c +++ b/src/fullfiles.c @@ -93,7 +93,7 @@ static void create_fullfile(struct file *file) assert(0); } - string_or_die(&tarcommand, "tar -C %s " TAR_PERM_ATTR_ARGS " -cf - '%s' --exclude='%s'/* 2> /dev/null | " + string_or_die(&tarcommand, "tar -C %s " TAR_PERM_ATTR_ARGS " -cf - --exclude='%s'/* '%s' 2> /dev/null | " "tar -C %s " TAR_PERM_ATTR_ARGS " -xf - 2> /dev/null", dir, base, base, rename_tmpdir); if (system(tarcommand) != 0) { @@ -111,8 +111,8 @@ static void create_fullfile(struct file *file) free(rename_source); /* for a directory file, tar up simply with gzip */ - string_or_die(&tarcommand, "tar -C %s %s " TAR_PERM_ATTR_ARGS " -zcf %s/%i/files/%s.tar", - rename_tmpdir, file->hash, outdir, file->last_change, file->hash); + string_or_die(&tarcommand, "tar -C %s " TAR_PERM_ATTR_ARGS " -zcf %s/%i/files/%s.tar %s", + rename_tmpdir, outdir, file->last_change, file->hash, file->hash); if (system(tarcommand) != 0) { LOG(NULL, "Failed to run command:", "%s", tarcommand); assert(0); -- 2.5.0