diff options
author | Jonathan Dieter <jonathan.dieter@spearline.com> | 2020-08-11 15:51:16 +0100 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2020-08-20 12:16:52 -0400 |
commit | ceae3a99d54154fac6073f30bba2618768d05362 (patch) | |
tree | 12527e17e077fe119cdb49a0f19132fa4f69f4d4 /pkg | |
parent | cb4c5fc9c262f14c935e843224ee80e098d58224 (diff) | |
download | podman-ceae3a99d54154fac6073f30bba2618768d05362.tar.gz podman-ceae3a99d54154fac6073f30bba2618768d05362.tar.bz2 podman-ceae3a99d54154fac6073f30bba2618768d05362.zip |
Fix hang when `path` doesn't exist
I'm not sure if this is an OS-specific issue, but on CentOS 8, if `path`
doesn't exist, this hangs while waiting to read from this socket, even
though the socket is closed by the `reexec_in_user_namespace`. Switching
to a pipe fixes the problem, and pipes shouldn't be an issue since this is
Linux-specific code.
Signed-off-by: Jonathan Dieter <jonathan.dieter@spearline.com>
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/rootless/rootless_linux.go | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/pkg/rootless/rootless_linux.go b/pkg/rootless/rootless_linux.go index 2e580347d..fb9f3e156 100644 --- a/pkg/rootless/rootless_linux.go +++ b/pkg/rootless/rootless_linux.go @@ -363,14 +363,12 @@ func TryJoinFromFilePaths(pausePidPath string, needNewNamespace bool, paths []st lastErr = nil break } else { - fds, err := unix.Socketpair(unix.AF_UNIX, unix.SOCK_DGRAM, 0) + r, w, err := os.Pipe() if err != nil { lastErr = err continue } - r, w := os.NewFile(uintptr(fds[0]), "read file"), os.NewFile(uintptr(fds[1]), "write file") - defer errorhandling.CloseQuiet(r) if _, _, err := becomeRootInUserNS("", path, w); err != nil { |