Eliminate the lock.

This commit is contained in:
Manuel Amador (Rudd-O) 2023-02-21 22:27:10 +00:00
parent 3a60f0ee4b
commit 8675eaa547

View File

@ -2,7 +2,6 @@
import base64 import base64
import pickle import pickle
import contextlib
import errno import errno
import fcntl import fcntl
import os import os
@ -43,18 +42,6 @@ def set_proc_name(newname):
libc.prctl(15, byref(buff), 0, 0, 0) libc.prctl(15, byref(buff), 0, 0, 0)
@contextlib.contextmanager
def mutexfile(filepath):
oldumask = os.umask(0o077)
try:
f = open(filepath, "a")
finally:
os.umask(oldumask)
fcntl.lockf(f.fileno(), fcntl.LOCK_EX)
yield
f.close()
def unset_cloexec(fd): def unset_cloexec(fd):
old = fcntl.fcntl(fd, fcntl.F_GETFD) old = fcntl.fcntl(fd, fcntl.F_GETFD)
fcntl.fcntl(fd, fcntl.F_SETFD, old & ~fcntl.FD_CLOEXEC) fcntl.fcntl(fd, fcntl.F_SETFD, old & ~fcntl.FD_CLOEXEC)
@ -370,7 +357,6 @@ def main_master():
saved_stderr = openfdforappend(os.dup(sys.stderr.fileno())) saved_stderr = openfdforappend(os.dup(sys.stderr.fileno()))
with mutexfile(os.path.expanduser("~/.bombshell-lock")):
try: try:
p = subprocess.Popen( p = subprocess.Popen(
["qrexec-client-vm", remote_vm, "qubes.VMShell"], ["qrexec-client-vm", remote_vm, "qubes.VMShell"],