tools: Fix error handling.
authorJustus Winter <justus@g10code.com>
Fri, 7 Oct 2016 10:52:09 +0000 (12:52 +0200)
committerJustus Winter <justus@g10code.com>
Fri, 7 Oct 2016 14:25:55 +0000 (16:25 +0200)
* tools/gpgtar-create.c (gpgtar_create): Do not crash if opening the
tarball failed.

Signed-off-by: Justus Winter <justus@g10code.com>
tools/gpgtar-create.c

index 6adc1f5..6780eff 100644 (file)
@@ -853,8 +853,6 @@ gpgtar_create (char **inpattern, int encrypt, int sign)
       if (!outstream)
         {
           err = gpg_error_from_syserror ();
-          log_error (_("can't create '%s': %s\n"),
-                     opt.outfile, gpg_strerror (err));
           goto leave;
         }
     }
@@ -958,7 +956,7 @@ gpgtar_create (char **inpattern, int encrypt, int sign)
   if (err)
     {
       log_error ("creating tarball '%s' failed: %s\n",
-                 es_fname_get (outstream), gpg_strerror (err));
+                 opt.outfile ? opt.outfile : "-", gpg_strerror (err));
       if (outstream && outstream != es_stdout)
         es_fclose (outstream);
       if (cipher_stream && cipher_stream != es_stdout)