summaryrefslogtreecommitdiffstats
path: root/tools/gpgtar-extract.c
diff options
context:
space:
mode:
authorJustus Winter <justus@g10code.com>2016-10-04 12:44:14 +0200
committerJustus Winter <justus@g10code.com>2016-10-04 13:23:17 +0200
commitfbc83c0cdd390473c044953fb774571ffc636c6d (patch)
tree4c4491bece8e0d55afba763e34b564bb2b74cd90 /tools/gpgtar-extract.c
parentagent, dirmngr, scd: npth_init must be after fork. (diff)
downloadgnupg2-fbc83c0cdd390473c044953fb774571ffc636c6d.tar.xz
gnupg2-fbc83c0cdd390473c044953fb774571ffc636c6d.zip
tools: Ignore existing directories in gpgtar.
* tools/gpgtar-extract.c (extract_directory): Ignore existing directories now that we have '--directory'. Signed-off-by: Justus Winter <justus@g10code.com>
Diffstat (limited to 'tools/gpgtar-extract.c')
-rw-r--r--tools/gpgtar-extract.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/gpgtar-extract.c b/tools/gpgtar-extract.c
index cee609c6a..864112624 100644
--- a/tools/gpgtar-extract.c
+++ b/tools/gpgtar-extract.c
@@ -122,11 +122,15 @@ extract_directory (const char *dirname, tar_header_t hdr)
if (fname[strlen (fname)-1] == '/')
fname[strlen (fname)-1] = 0;
- /* Note that we don't need to care about EEXIST because we always
- extract into a new hierarchy. */
if (! opt.dry_run && gnupg_mkdir (fname, "-rwx------"))
{
err = gpg_error_from_syserror ();
+ if (gpg_err_code (err) == GPG_ERR_EEXIST)
+ {
+ /* Ignore existing directories while extracting. */
+ err = 0;
+ }
+
if (gpg_err_code (err) == GPG_ERR_ENOENT)
{
/* Try to create the directory with parents but keep the