diff options
author | Helmut Grohne <helmut@subdivi.de> | 2025-08-18 21:07:12 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2025-08-18 21:07:12 +0200 |
commit | 964d52e62e64de4b860770743f08815acc99d9d3 (patch) | |
tree | cd0734d4373909b72ffe53357525f65b42c3c4e6 /examples | |
parent | 0b69be3638a856c986e873fe0fbe8facf874f39f (diff) | |
download | python-linuxnamespaces-964d52e62e64de4b860770743f08815acc99d9d3.tar.gz |
examples/unschroot_proc.py: tell asyncvarlink which fds to close
This requires version asyncvarlink >= 0.2.1.
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/unschroot_proc.py | 12 |
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( |