aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMasatake YAMATO <yamato@redhat.com>2024-04-14 02:05:10 +0900
committerMasatake YAMATO <yamato@redhat.com>2024-04-15 02:06:53 +0900
commit7c33788b8614758b541028cad86744ace1e5e5a8 (patch)
tree5b2cc9fa2288f98b0f3565d6466270f7237436c4
parentf2a8b20d9c63f771d1fddd639ea1ec3fe034dc6d (diff)
downloadutil-linux-7c33788b8614758b541028cad86744ace1e5e5a8.tar.gz
lsns: fill the netsid member of lsns_process with reliable value
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
-rw-r--r--sys-utils/lsns.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys-utils/lsns.c b/sys-utils/lsns.c
index 8b70fd7cdb..0ab5e26a30 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;
}