aboutsummaryrefslogtreecommitdiffstats
path: root/tools/gpgtar-create.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2019-03-06 19:08:26 +0000
committerWerner Koch <[email protected]>2019-03-07 09:56:18 +0000
commit5d73c231e4f2d5994eb3be48b36517e39d66be96 (patch)
tree4c96a01daddea37593230141bd2e681f58da8f9a /tools/gpgtar-create.c
parentgpgtar: Improve error messages. (diff)
downloadgnupg-5d73c231e4f2d5994eb3be48b36517e39d66be96.tar.gz
gnupg-5d73c231e4f2d5994eb3be48b36517e39d66be96.zip
gpgtar: Make option -C work for archive creation.
* tools/gpgtar-create.c (gpgtar_create): Switch to the -C directory. -- The -C option is pretty useful given that pattern are always relative to the current directory. In contrast to GNU tar, the switching is done only once. Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit b3a7a5140784b5a015107b5c5c73b15ae44e71dc)
Diffstat (limited to '')
-rw-r--r--tools/gpgtar-create.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/gpgtar-create.c b/tools/gpgtar-create.c
index c622a6672..a08601634 100644
--- a/tools/gpgtar-create.c
+++ b/tools/gpgtar-create.c
@@ -762,6 +762,14 @@ gpgtar_create (char **inpattern, int encrypt, int sign)
memset (scanctrl, 0, sizeof *scanctrl);
scanctrl->flist_tail = &scanctrl->flist;
+ if (opt.directory && gnupg_chdir (opt.directory))
+ {
+ err = gpg_error_from_syserror ();
+ log_error ("chdir to '%s' failed: %s\n",
+ opt.directory, gpg_strerror (err));
+ return err;
+ }
+
while (!eof_seen)
{
char *pat, *p;