Here is a new patch since there is a new commit fixing the unlink but
it had 3 issues.

- unlink returns an errno so it can't be used before the if statement (x2)
- The unlink from the 2nd hunk is also missing.

Also my previous patch had an error but it's fixed here.

Cheers,
Miguel
From 3814ed0718a05853a27d518454ec856eb0b41220 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20A=2E=20Col=C3=B3n=20V=C3=A9lez?=
 <debian.mic...@gmail.com>
Date: Tue, 15 Sep 2015 06:07:46 -0400
Subject: [PATCH] Fix unlink again.

- unlink returns an errno so it can't be ut before the if statement
- The unlink from the 2nd hunk is also missing.
---
 lib/Sbuild/ResolverBase.pm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/Sbuild/ResolverBase.pm b/lib/Sbuild/ResolverBase.pm
index 517c1ca..db54289 100644
--- a/lib/Sbuild/ResolverBase.pm
+++ b/lib/Sbuild/ResolverBase.pm
@@ -1067,12 +1067,13 @@ EOF
             { COMMAND => \@gpg_command,
               USER => 'root',
               PRIORITY => 0});
-        unlink $tmpfilename;
         if ($?) {
             $self->log("Failed to import archive keys to the trusted keyring");
             $self->cleanup_apt_archive();
+            unlink $tmpfilename;
             return 0;
         }
+        unlink $tmpfilename;
     }
 
     # Write a list file for the dummy archive if one not create yet.
@@ -1094,6 +1095,7 @@ EOF
         if ($?) {
             $self->log("Failed to create apt list file for dummy archive.\n");
             $self->cleanup_apt_archive();
+            unlink $tmpfilename;
             return 0;
         }
         $session->run_command(
@@ -1101,12 +1103,13 @@ EOF
                           $session->strip_chroot_path($dummy_archive_list_file)],
               USER => 'root',
               PRIORITY => 0});
-        unlink $tmpfilename;
         if ($?) {
             $self->log("Failed to create apt list file for dummy archive.\n");
             $self->cleanup_apt_archive();
+            unlink $tmpfilename;
             return 0;
         }
+        unlink $tmpfilename;
     }
 
     if (!$self->get_conf('APT_ALLOW_UNAUTHENTICATED')) {
-- 
2.5.1

Reply via email to