summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/unschroot_proc.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/examples/unschroot_proc.py b/examples/unschroot_proc.py
index 771d0d8..96da4e5 100755
--- a/examples/unschroot_proc.py
+++ b/examples/unschroot_proc.py
@@ -607,8 +607,8 @@ class ContainerSupervisor(asyncvarlink.VarlinkInterface):
child_sock.close()
return ContainerSupervisor.ForkResult(
pid=pid,
- pidfd=asyncvarlink.FileDescriptor(pidfd),
- socket=asyncvarlink.FileDescriptor(parent_sock),
+ pidfd=asyncvarlink.FileDescriptor(pidfd, should_close=True),
+ socket=asyncvarlink.FileDescriptor(parent_sock, should_close=True),
)
@asyncvarlink.varlinkmethod
@@ -722,7 +722,9 @@ class ContainerSupervisor(asyncvarlink.VarlinkInterface):
# The caller should call Terminate next. Doing so will close the wpipe
# and thus allow the child process to proceed.
- return asyncvarlink.FileDescriptor(os.pidfd_open(init_process.pid))
+ return asyncvarlink.FileDescriptor(
+ os.pidfd_open(init_process.pid), should_close=True
+ )
@asyncvarlink.varlinkmethod(return_parameter="status")
async def Waitpidfd(self, *, pidfd: asyncvarlink.FileDescriptor) -> int:
@@ -800,7 +802,9 @@ class ContainerSupervisor(asyncvarlink.VarlinkInterface):
if options.get("ro", True) is None:
flags |= linuxnamespaces.MountFlags.RDONLY
del options["ro"]
- fusefd = asyncvarlink.FileDescriptor(os.open("/dev/fuse", os.O_RDWR))
+ fusefd = asyncvarlink.FileDescriptor(
+ os.open("/dev/fuse", os.O_RDWR), should_close=True
+ )
try:
options["fd"] = fusefd.fileno()
linuxnamespaces.mount(