]> git.saurik.com Git - apt.git/commitdiff
gpgv: Unlink the correct temp file in error case
authorJulian Andres Klode <jak@debian.org>
Thu, 28 Jul 2016 10:41:27 +0000 (12:41 +0200)
committerJulian Andres Klode <jak@debian.org>
Wed, 5 Oct 2016 10:02:19 +0000 (12:02 +0200)
Previously, when data could be created and sig not, we would unlink
sig, not data (and vice versa).

(cherry picked from commit d0d06f44ed60a3888528d834a799bae86c2978d5)

apt-pkg/contrib/gpgv.cc

index 0929ae0e2c06c40922548c5ae6a27e2e2dbc3f2c..4a2f34043e323f03d21744dad63dc57ae862138f 100644 (file)
@@ -118,9 +118,9 @@ void ExecGPGV(std::string const &File, std::string const &FileGPG,
       if (sigFd == -1 || dataFd == -1)
       {
         if (dataFd != -1)
-           unlink(sig);
-        if (sigFd != -1)
            unlink(data);
+        if (sigFd != -1)
+           unlink(sig);
         ioprintf(std::cerr, "Couldn't create tempfiles for splitting up %s", File.c_str());
         exit(EINTERNAL);
       }
@@ -134,9 +134,9 @@ void ExecGPGV(std::string const &File, std::string const &FileGPG,
            SplitClearSignedFile(File, &message, &dataHeader, &signature) == false)
       {
         if (dataFd != -1)
-           unlink(sig);
-        if (sigFd != -1)
            unlink(data);
+        if (sigFd != -1)
+           unlink(sig);
         ioprintf(std::cerr, "Splitting up %s into data and signature failed", File.c_str());
         exit(112);
       }