dnf/get-lockfile-exists-before-unlick.patch
small_leek 13c74d9727 check target exist before unlink
(cherry picked from commit 20908f684234d1793a17256f9cf668421140b8ac)
2023-01-11 19:50:07 +08:00

25 lines
695 B
Diff

From 5cf9fbe5096c807668da3c1685c917996b91c960 Mon Sep 17 00:00:00 2001
From: Duan Pengjie <pengjieduan@gmail.com>
Date: Wed, 4 Jan 2023 11:51:23 +0800
Subject: [PATCH] add exists
---
dnf/lock.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dnf/lock.py b/dnf/lock.py
index ee7a0db..a94132a 100644
--- a/dnf/lock.py
+++ b/dnf/lock.py
@@ -161,6 +161,6 @@ class ProcessLock(object):
pid = self._try_lock(my_pid)
def __exit__(self, *exc_args):
- if self.count == 1:
+ if self.count == 1 and os.path.exists(self.target):
os.unlink(self.target)
self._unlock_thread()
--
2.37.1 (Apple Git-137.1)