File: lsns-fix-undefined-reference-to-add_namespace_for_nsfd-34.patch

package info (click to toggle)
util-linux 2.41-5
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 95,208 kB
  • sloc: ansic: 179,016; sh: 22,689; yacc: 1,284; makefile: 528; xml: 422; python: 316; lex: 89; ruby: 75; csh: 37; exp: 19; sed: 16; perl: 15; sql: 9
file content (53 lines) | stat: -rw-r--r-- 1,718 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From: Thomas Devoogdt <thomas.devoogdt@barco.com>
Date: Tue, 25 Mar 2025 11:58:18 +0100
Subject: lsns: fix undefined reference to add_namespace_for_nsfd #3483

Fixes:

sys-utils/lsns-lsns.o: In function `read_process':
lsns.c:(.text+0x9e8): undefined reference to `add_namespace_for_nsfd'
collect2: error: ld returned 1 exit status

Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
(cherry picked from commit 2ced43400f35f7bd45b29364e04166a63a06e16a)
---
 sys-utils/lsns.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sys-utils/lsns.c b/sys-utils/lsns.c
index 2b613cf..4c49a8b 100644
--- a/sys-utils/lsns.c
+++ b/sys-utils/lsns.c
@@ -587,7 +587,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:
@@ -608,6 +611,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)
 {
@@ -627,11 +631,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);
 		}