]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsfd: initialize struct stat [coverity scan]
authorKarel Zak <kzak@redhat.com>
Wed, 12 Mar 2025 14:16:18 +0000 (15:16 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 17 Mar 2025 11:21:53 +0000 (12:21 +0100)
It's probably unnecessary, but for a complicated function, it's
probably better just to keep the static analyzer happy.

Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit e05e2b4f89a00fadc1032ad7720fefdd99dca029)

lsfd-cmd/lsfd.c

index 41abeb204ba909b1d0d20454210ec774ec771c08..66c60a4e8c01ec6409481a38d55f2abf7832739e 100644 (file)
@@ -872,7 +872,7 @@ static struct file *collect_file_symlink(struct path_cxt *pc,
                                         bool sockets_only)
 {
        char sym[PATH_MAX] = { '\0' };
-       struct stat sb;
+       struct stat sb = { .st_mode = 0 };
        struct file *f, *prev;
 
        if (ul_path_readlink(pc, sym, sizeof(sym), name) < 0)
@@ -963,7 +963,7 @@ static void parse_maps_line(struct path_cxt *pc, char *buf, struct proc *proc)
        uint64_t start, end, offset, ino;
        unsigned long major, minor;
        enum association assoc = ASSOC_MEM;
-       struct stat sb;
+       struct stat sb = { .st_mode = 0 };
        struct file *f, *prev;
        char *path, modestr[5];
        dev_t devno;