From 7c33788b8614758b541028cad86744ace1e5e5a8 Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Sun, 14 Apr 2024 02:05:10 +0900 Subject: [PATCH] lsns: fill the netsid member of lsns_process with reliable value Signed-off-by: Masatake YAMATO --- sys-utils/lsns.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys-utils/lsns.c b/sys-utils/lsns.c index 8b70fd7cd..0ab5e26a3 100644 --- a/sys-utils/lsns.c +++ b/sys-utils/lsns.c @@ -305,6 +305,7 @@ static int get_ns_ino(struct path_cxt *pc, const char *nsname, ino_t *ino, ino_t snprintf(path, sizeof(path), "ns/%s", nsname); + *ino = 0; if (ul_path_stat(pc, &st, 0, path) != 0) return -errno; *ino = st.st_ino; @@ -573,7 +574,7 @@ static int read_process(struct lsns *ls, struct path_cxt *pc) DBG(PROC, ul_debug("failed in get_ns_ino (rc: %d)", rc)); goto done; } - if (i == LSNS_ID_NET) + if (p->ns_ids[i] && i == LSNS_ID_NET) p->netnsid = get_netnsid(pc, p->ns_ids[i]); rc = 0; } -- 2.47.3