From ec8644e42ec2e0d0f98ea1aee3859b2c510f0cc0 Mon Sep 17 00:00:00 2001 From: chenhaixing Date: Sat, 4 Jun 2022 17:49:53 +0800 Subject: [PATCH] verify-parameter --- dnf/lock.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dnf/lock.py b/dnf/lock.py index ab05a3b..12378ec 100644 --- a/dnf/lock.py +++ b/dnf/lock.py @@ -116,7 +116,12 @@ class ProcessLock(object): return pid try: - with open('/proc/%d/status' % old_pid) as f: + old_pid_path = f'/proc/{old_pid}/status' + true_old_pid_path = os.path.realpath(old_pid_path) + if not true_old_pid_path.startswith("/proc/"): + return old_pid + + with open(true_old_pid_path) as f: if not re.findall(r'Name:(.*)(dnf|yum)', f.read(), re.I): os.write(fd, str(pid).encode('utf-8')) return pid -- 2.27.0