1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

gpgtar: Prefer --set-filename over implicit name

* tools/gpgtar-extract.c: Prefer opt.filename over filename
for the directory prefix.

--
If you would extract from stdin (filename -) and use set-filename
to provide a real filename the "-" would be used for the directory
name. With this change an explicit filename is prefered.

GnuPG-Bug-Id: T3500
Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
This commit is contained in:
Andre Heinecke 2017-11-15 09:54:05 +01:00
parent 1faf8187f9
commit 878b8bfdcc
No known key found for this signature in database
GPG Key ID: 2978E9D40CBABA5C

View File

@ -345,15 +345,7 @@ gpgtar_extract (const char *filename, int decrypt)
dirname = xtrystrdup (opt.directory);
else
{
if (filename)
{
dirprefix = strrchr (filename, '/');
if (dirprefix)
dirprefix++;
else
dirprefix = filename;
}
else if (opt.filename)
if (opt.filename)
{
dirprefix = strrchr (opt.filename, '/');
if (dirprefix)
@ -361,6 +353,14 @@ gpgtar_extract (const char *filename, int decrypt)
else
dirprefix = opt.filename;
}
else if (filename)
{
dirprefix = strrchr (filename, '/');
if (dirprefix)
dirprefix++;
else
dirprefix = filename;
}
if (!dirprefix || !*dirprefix)
dirprefix = "GPGARCH";