[pacman-dev] FS#66472: Remove *.sig file if package corrupted

Message ID 20200915015256.66524-1-anatol.pomozov@gmail.com
State New
Headers show
Series
  • [pacman-dev] FS#66472: Remove *.sig file if package corrupted
Related show

Commit Message

Anatol Pomozov Sept. 15, 2020, 1:52 a.m. UTC
In case if a package corrupted (e.g. signature or hash is invalid)
pacman tries to remove the package file to redownload it anew the next time.
Remove *.sig file as well to make sure no data is left for the invalid
package.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
---
 lib/libalpm/sync.c | 6 ++++++
 1 file changed, 6 insertions(+)

Patch

diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 9350793a..9397575a 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -688,7 +688,13 @@  static int prompt_to_delete(alpm_handle_t *handle, const char *filepath,
 	};
 	QUESTION(handle, &question);
 	if(question.remove) {
+		char *sig_filename;
+
 		unlink(filepath);
+
+		sig_filename = _alpm_sigpath(handle, filepath);
+		unlink(sig_filename);
+		FREE(sig_filename);
 	}
 	return question.remove;
 }