From: Masatake YAMATO Date: Sat, 13 Apr 2024 17:05:10 +0000 (+0900) Subject: lsns: fill the netsid member of lsns_process with reliable value X-Git-Tag: v2.42-start~424 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7c33788b8614758b541028cad86744ace1e5e5a8;p=thirdparty%2Futil-linux.git lsns: fill the netsid member of lsns_process with reliable value Signed-off-by: Masatake YAMATO --- 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; }