chiark / gitweb /
fishdescriptor: Cope if donor is in a chroot without /proc
authorIan Jackson <ian.jackson@eu.citrix.com>
Mon, 19 Nov 2018 16:08:57 +0000 (16:08 +0000)
committerIan Jackson <ian.jackson@eu.citrix.com>
Mon, 19 Nov 2018 16:22:07 +0000 (16:22 +0000)
`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 <george.dunlap@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
fishdescriptor/py/fishdescriptor/fish.py

index b47ac3dbb6aeb493b56f86a33aed9ff1cbf72669..9d2d3c631fbead808ec46e3c5751819606419458 100644 (file)
@@ -157,7 +157,7 @@ class Donor():
             os.chmod(our_sockname, 666)
             s.listen(1)
 
             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)
 
             (s2, dummy) = s.accept()
             (msg, ancil, flags, sender) = s2.recvmsg(1, ancil_len)