From a0a76f42650fb4bf6773349b14b52be5b52339d7 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 12 Oct 2018 12:48:42 +0200 Subject: [PATCH] lsblk: properly initialize structs Signed-off-by: Karel Zak --- misc-utils/lsblk.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index e5785dd9a9..e8710f3d60 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -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; -- 2.47.2