qmemman: in client code, set FD_CLOEXEC on qmmemman.socket
This commit is contained in:
parent
7545789a26
commit
f4e46b63a4
@ -1,9 +1,14 @@
|
|||||||
import socket
|
import socket
|
||||||
|
import fcntl
|
||||||
class QMemmanClient:
|
class QMemmanClient:
|
||||||
|
|
||||||
def request_memory(self, amount):
|
def request_memory(self, amount):
|
||||||
self.sock = socket.socket(socket.AF_UNIX)
|
self.sock = socket.socket(socket.AF_UNIX)
|
||||||
|
|
||||||
|
flags = fcntl.fcntl(self.sock.fileno(), fcntl.F_GETFD)
|
||||||
|
flags |= fcntl.FD_CLOEXEC
|
||||||
|
fcntl.fcntl(self.sock.fileno(), fcntl.F_SETFD, flags)
|
||||||
|
|
||||||
self.sock.connect("/var/run/qubes/qmemman.sock")
|
self.sock.connect("/var/run/qubes/qmemman.sock")
|
||||||
self.sock.send(str(amount)+"\n")
|
self.sock.send(str(amount)+"\n")
|
||||||
self.received = self.sock.recv(1024).strip()
|
self.received = self.sock.recv(1024).strip()
|
||||||
|
Loading…
Reference in New Issue
Block a user