Skip to content

Commit

Permalink
lsblk: properly initialize structs
Browse files Browse the repository at this point in the history
Signed-off-by: Karel Zak <[email protected]>
  • Loading branch information
karelzak committed Dec 7, 2018
1 parent 7cd9de4 commit a0a76f4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions misc-utils/lsblk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -1299,7 +1300,7 @@ static int iterate_block_devices(void)

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;
Expand Down

0 comments on commit a0a76f4

Please sign in to comment.