]> git.ipfire.org Git - thirdparty/util-linux.git/commit
nsenter: improve portability to older kernels
authorKarel Zak <kzak@redhat.com>
Wed, 6 Nov 2024 09:18:17 +0000 (10:18 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 6 Nov 2024 09:22:09 +0000 (10:22 +0100)
commite8a6b41016bf2b059c6f177505c75f19b47e5c9b
tree1391c7320fd8e315a3a768385dde29dfe7b23419
parent0e0fafce526d69fac11d19e41d4b1905077ac843
nsenter: improve portability to older kernels

The pidfd cannot be used to enter namespaces using setns() before
Linux 5.7. To ensure compatibility with older kernels, we will check
the kernel version before using pidfd_open() and, if necessary, fall
back to using the classic /proc/#/ns/ files.

Reported-by: Alex Xu
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/nsenter.1.adoc
sys-utils/nsenter.c