aboutsummaryrefslogtreecommitdiffstats
path: root/sys-utils
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2025-04-01 14:26:44 +0200
committerKarel Zak <kzak@redhat.com>2025-04-01 14:26:44 +0200
commita5cc4014d3883c4c628a3df7dd6372a9047bccef (patch)
tree85f03db527c9922f6db7b91767a31278dca2eee2 /sys-utils
parent477752620c9826ce9b568045f3184d04464ff67e (diff)
parent2ced43400f35f7bd45b29364e04166a63a06e16a (diff)
downloadutil-linux-a5cc4014d3883c4c628a3df7dd6372a9047bccef.tar.gz
Merge branch 'bugfix/undefined-reference-add_namespace_for_nsfd' of https://github.com/ThomasDevoogdt/util-linux
* 'bugfix/undefined-reference-add_namespace_for_nsfd' of https://github.com/ThomasDevoogdt/util-linux: lsns: fix undefined reference to add_namespace_for_nsfd #3483
Diffstat (limited to 'sys-utils')
-rw-r--r--sys-utils/lsns.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys-utils/lsns.c b/sys-utils/lsns.c
index d91c001da6..124b6ec8eb 100644
--- a/sys-utils/lsns.c
+++ b/sys-utils/lsns.c
@@ -616,7 +616,10 @@ static void add_namespace_from_sock(struct lsns *ls, pid_t pid, uint64_t fd)
if (get_namespace(ls, sb.st_ino))
goto out_nsfd;
+#ifdef USE_NS_GET_API
add_namespace_for_nsfd(ls, nsfd, sb.st_ino);
+#endif
+
out_nsfd:
close(nsfd);
out_sk:
@@ -642,6 +645,7 @@ static void add_namespace_from_sock(struct lsns *ls __attribute__((__unused__)),
{
}
#endif /* HAVE_LINUX_NET_NAMESPACE_H */
+
/* Read namespaces open(2)ed explicitly by the process specified by `pc'. */
static void read_opened_namespaces(struct lsns *ls, struct path_cxt *pc, pid_t pid)
{
@@ -661,11 +665,13 @@ static void read_opened_namespaces(struct lsns *ls, struct path_cxt *pc, pid_t p
if (st.st_dev == ls->nsfs_dev) {
if (get_namespace(ls, st.st_ino))
continue;
+#ifdef USE_NS_GET_API
int fd = ul_path_openf(pc, O_RDONLY, "fd/%ju", (uintmax_t) num);
if (fd >= 0) {
add_namespace_for_nsfd(ls, fd, st.st_ino);
close(fd);
}
+#endif
} else if ((st.st_mode & S_IFMT) == S_IFSOCK) {
add_namespace_from_sock(ls, pid, num);
}