From: Ian Jackson Date: Mon, 19 Nov 2018 16:08:57 +0000 (+0000) Subject: fishdescriptor: Cope if donor is in a chroot without /proc X-Git-Tag: archive/debian/6.0.3~4 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=chiark-utils.git;a=commitdiff_plain;h=79dee035863a6967c1bb946c679f516bd9267b62;ds=sidebyside fishdescriptor: Cope if donor is in a chroot without /proc `our_sockname' contains something like /proc/DONOR/root/run/user/UID/fishdescriptor/SOCKET When I tested this I did it in a chroot where /proc was mounted. In such a chroot /proc/DONOR/root -> /. So this works. But if there is no /proc, it does not work. Instead, we can can and should assume that the path in the donor is relative to its own root. Ie, we can just use `sockname'. CC: George Dunlap Signed-off-by: Ian Jackson --- diff --git a/fishdescriptor/py/fishdescriptor/fish.py b/fishdescriptor/py/fishdescriptor/fish.py index b47ac3d..9d2d3c6 100644 --- a/fishdescriptor/py/fishdescriptor/fish.py +++ b/fishdescriptor/py/fishdescriptor/fish.py @@ -157,7 +157,7 @@ class Donor(): os.chmod(our_sockname, 666) s.listen(1) - ancil_len = d.donate(our_sockname, fds) + ancil_len = d.donate(sockname, fds) (s2, dummy) = s.accept() (msg, ancil, flags, sender) = s2.recvmsg(1, ancil_len)