mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 11:14:02 +02:00
Mark the fd used for singleinstance of OS X as CLOEXEC
This commit is contained in:
parent
da0c6f8048
commit
acfff78330
1 changed files with 2 additions and 0 deletions
|
|
@ -242,6 +242,8 @@ def singleinstance(name):
|
|||
from calibre.utils.ipc import eintr_retry_call
|
||||
path = singleinstance_path(name)
|
||||
f = open(path, 'w')
|
||||
old_flags = fcntl.fcntl(f.fileno(), fcntl.F_GETFD)
|
||||
fcntl.fcntl(f.fileno(), fcntl.F_SETFD, old_flags | fcntl.FD_CLOEXEC)
|
||||
try:
|
||||
eintr_retry_call(fcntl.lockf, f.fileno(), fcntl.LOCK_EX|fcntl.LOCK_NB)
|
||||
atexit.register(_clean_lock_file, f)
|
||||
|
|
|
|||
Loading…
Reference in a new issue