]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsns: check for mnt_fs_get_target return value
authorKarel Zak <kzak@redhat.com>
Thu, 16 Jan 2025 16:10:25 +0000 (17:10 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 16 Jan 2025 16:10:25 +0000 (17:10 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/lsns.c

index 93bbd758b24a7948ba80c82d84b161434d66b444..6b2dcba960d08659f9590bb04402a3cf7b346c50 100644 (file)
@@ -1012,7 +1012,8 @@ static int read_persistent_namespaces(struct lsns *ls)
                        continue;
                if (get_namespace(ls, ino))
                        continue;
-
+               if (!mnt_fs_get_target(fs))
+                       continue;
                fd = open(mnt_fs_get_target(fs), O_RDONLY);
                if (fd < 0)
                        continue;
@@ -1137,7 +1138,6 @@ static int nsfs_xasputs(char **str,
 
                if (!*str)
                        xasprintf(str, "%s", tgt);
-
                else if (!is_path_included(*str, tgt, sep)) {
                        char *tmp = NULL;