mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Prevent sockets launched for IPC communication on linux from being inherited by processes launched from the GUI
Previously only the listen socket was marked as CLOEXEC, now the actual fd used for communication is also marked as CLOEXEC
This commit is contained in:
parent
288ef018df
commit
d23edad6b9
@ -112,6 +112,13 @@ if islinux:
|
||||
self._listener._socket.shutdown(socket.SHUT_RDWR)
|
||||
self._listener._socket.close()
|
||||
|
||||
def accept(self, *args, **kwargs):
|
||||
ans = Listener.accept(self, *args, **kwargs)
|
||||
fd = ans.fileno()
|
||||
old_flags = fcntl.fcntl(fd, fcntl.F_GETFD)
|
||||
fcntl.fcntl(fd, fcntl.F_SETFD, old_flags | fcntl.FD_CLOEXEC)
|
||||
return ans
|
||||
|
||||
def create_listener(authkey, backlog=4):
|
||||
# Use abstract named sockets on linux to avoid creating unnecessary temp files
|
||||
global _name_counter
|
||||
|
Loading…
x
Reference in New Issue
Block a user