[Coverity Scan is ok, make syntax-check is ok, make check-valgrind is ok, 
contrib/check-hard is ok]

This fixes the downloaded/saved file name used when printing the output.

The following description is verbatim from the patch:
-----
The file name could have been changed by unique_create() (or by any
other mean) before downloading. Use the name of the downloaded file
(filename) when printing output which refer to it.
-----

Regards,
Matthew

-- 
Matthew White <[email protected]>
>From 0a41d7a593bf8b1be7231146af2b8bdf7755e4fa Mon Sep 17 00:00:00 2001
From: Matthew White <[email protected]>
Date: Tue, 16 Aug 2016 23:18:46 +0200
Subject: [PATCH 07/25] Change mfile->name to filename in Metalink module's
 messages

* src/metalink.c (retrieve_from_metalink): Change mfile->name to
  filename when referring to the downloaded file

The file name could have been changed by unique_create() (or by any
other mean) before downloading. Use the name of the downloaded file
(filename) when printing output which refer to it.
---
 src/metalink.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/metalink.c b/src/metalink.c
index c5926fc..13d0e6a 100644
--- a/src/metalink.c
+++ b/src/metalink.c
@@ -328,7 +328,7 @@ retrieve_from_metalink (const metalink_t* metalink)
                     }
 
                   logprintf (LOG_VERBOSE, _("Computing checksum for %s\n"),
-                             quote (mfile->name));
+                             quote (filename));
 
                   DEBUGP (("Declared hash: %s\n", mchksum->hash));
 
@@ -411,7 +411,7 @@ retrieve_from_metalink (const metalink_t* metalink)
                     {
                       logprintf (LOG_NOTQUIET,
                                  _("Checksum mismatch for file %s.\n"),
-                                 quote (mfile->name));
+                                 quote (filename));
                     }
 
                   /* Stop as soon as we checked the supported checksum.  */
@@ -595,14 +595,14 @@ gpg_skip_verification:
       if (retr_err != RETROK)
         {
           logprintf (LOG_VERBOSE, _("Failed to download %s. Skipping resource.\n"),
-                     quote (mfile->name));
+                     quote (filename ? filename : mfile->name));
         }
       else if (!hash_ok)
         {
           retr_err = METALINK_CHKSUM_ERROR;
           logprintf (LOG_NOTQUIET,
                      _("File %s retrieved but checksum does not match. "
-                       "\n"), quote (mfile->name));
+                       "\n"), quote (filename));
         }
 #ifdef HAVE_GPGME
         /* Signature will be only validated if hash check was successful.  */
@@ -611,7 +611,7 @@ gpg_skip_verification:
           retr_err = METALINK_SIG_ERROR;
           logprintf (LOG_NOTQUIET,
                      _("File %s retrieved but signature does not match. "
-                       "\n"), quote (mfile->name));
+                       "\n"), quote (filename));
         }
 #endif
       last_retr_err = retr_err == RETROK ? last_retr_err : retr_err;
-- 
2.7.3

Attachment: pgpS_Acmu03Qz.pgp
Description: PGP signature

Reply via email to