aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--python/qemu/machine/machine.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py
index 35d5a672db..345610d6e4 100644
--- a/python/qemu/machine/machine.py
+++ b/python/qemu/machine/machine.py
@@ -301,9 +301,7 @@ class QEMUMachine:
if self._qmp_set:
if self._sock_pair:
- fd = self._sock_pair[0].fileno()
- os.set_inheritable(fd, True)
- moncdev = f"socket,id=mon,fd={fd}"
+ moncdev = f"socket,id=mon,fd={self._sock_pair[0].fileno()}"
elif isinstance(self._monitor_address, tuple):
moncdev = "socket,id=mon,host={},port={}".format(
*self._monitor_address
@@ -340,6 +338,7 @@ class QEMUMachine:
if self._qmp_set:
if self._monitor_address is None:
self._sock_pair = socket.socketpair()
+ os.set_inheritable(self._sock_pair[0].fileno(), True)
sock = self._sock_pair[1]
if isinstance(self._monitor_address, str):
self._remove_files.append(self._monitor_address)