]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsblk: properly initialize structs
authorKarel Zak <kzak@redhat.com>
Fri, 12 Oct 2018 10:48:42 +0000 (12:48 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 7 Dec 2018 11:32:57 +0000 (12:32 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/lsblk.c

index e5785dd9a92c8558d99316980b8cac314d4d18b7..e8710f3d604d0e6d78260fd3cbb3ebd0c7b4befa 100644 (file)
@@ -1081,6 +1081,7 @@ static int set_device(struct lsblk_device *dev,
        return 0;
 }
 
+
 static int process_blkdev(struct lsblk_device *dev, struct lsblk_device *parent,
                          int do_partitions, const char *part_name);
 
@@ -1092,7 +1093,7 @@ static int list_partitions(struct lsblk_device *wholedisk_dev, struct lsblk_devi
 {
        DIR *dir;
        struct dirent *d;
-       struct lsblk_device part_dev = { NULL };
+       struct lsblk_device part_dev = { .parent = NULL };
        int r = -1;
 
        assert(wholedisk_dev);
@@ -1195,7 +1196,7 @@ static int list_deps(struct lsblk_device *dev)
 {
        DIR *dir;
        struct dirent *d;
-       struct lsblk_device dep = { NULL };
+       struct lsblk_device dep = { .parent = NULL };
        const char *depname;
 
        assert(dev);
@@ -1256,7 +1257,7 @@ static int iterate_block_devices(void)
 {
        DIR *dir;
        struct dirent *d;
-       struct lsblk_device dev = { NULL };
+       struct lsblk_device dev = { .parent = NULL };
        struct path_cxt *pc = ul_new_path(_PATH_SYS_BLOCK);
 
        if (!pc)
@@ -1299,7 +1300,7 @@ done:
 
 static int process_one_device(char *devname)
 {
-       struct lsblk_device parent = { NULL }, dev = { NULL };
+       struct lsblk_device parent = { .parent = NULL }, dev = { .parent = NULL };
        struct stat st;
        char buf[PATH_MAX + 1], *name = NULL, *diskname = NULL;
        dev_t disk = 0;