mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Mark the fd used for singleinstance of OS X as CLOEXEC
This commit is contained in:
parent
da0c6f8048
commit
acfff78330
@ -242,6 +242,8 @@ else:
|
|||||||
from calibre.utils.ipc import eintr_retry_call
|
from calibre.utils.ipc import eintr_retry_call
|
||||||
path = singleinstance_path(name)
|
path = singleinstance_path(name)
|
||||||
f = open(path, 'w')
|
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:
|
try:
|
||||||
eintr_retry_call(fcntl.lockf, f.fileno(), fcntl.LOCK_EX|fcntl.LOCK_NB)
|
eintr_retry_call(fcntl.lockf, f.fileno(), fcntl.LOCK_EX|fcntl.LOCK_NB)
|
||||||
atexit.register(_clean_lock_file, f)
|
atexit.register(_clean_lock_file, f)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user