mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
tools/gpgtar: Add '--dry-run'.
* tools/gpgtar-extract.c (extract_{regular,directory}): Honor '--dry-run'. * tools/gpgtar.c (enum cmd_and_opt_values): New value. (opts): Add '--dry-run'. (parse_arguments): Handle '--dry-run'. * tools/gpgtar.h (opt): Add field 'dry_run'. Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
parent
69a8440f44
commit
676b2d7081
3 changed files with 14 additions and 2 deletions
|
@ -53,7 +53,10 @@ extract_regular (estream_t stream, const char *dirname,
|
|||
else
|
||||
err = 0;
|
||||
|
||||
outfp = es_fopen (fname, "wb");
|
||||
if (opt.dry_run)
|
||||
outfp = es_fopenmem (0, "wb");
|
||||
else
|
||||
outfp = es_fopen (fname, "wb");
|
||||
if (!outfp)
|
||||
{
|
||||
err = gpg_error_from_syserror ();
|
||||
|
@ -120,7 +123,7 @@ extract_directory (const char *dirname, tar_header_t hdr)
|
|||
|
||||
/* Note that we don't need to care about EEXIST because we always
|
||||
extract into a new hierarchy. */
|
||||
if (gnupg_mkdir (fname, "-rwx------"))
|
||||
if (! opt.dry_run && gnupg_mkdir (fname, "-rwx------"))
|
||||
{
|
||||
err = gpg_error_from_syserror ();
|
||||
if (gpg_err_code (err) == GPG_ERR_ENOENT)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue