From 46ef8316f7ed6530155057a203ef3ed386bbd50d Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Fri, 10 May 2019 08:09:02 +0200 Subject: [PATCH] iostat: Fix iostat regression for groups of devices Device groups specified with iostat's option -g were no longer displayed in the device report because of a regression introduced by commit ccda26c. Fix that. Signed-off-by: Sebastien GODARD --- iostat.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/iostat.c b/iostat.c index d93a0b5..42353e6 100644 --- a/iostat.c +++ b/iostat.c @@ -375,18 +375,18 @@ void io_sys_init(int *iodev_nr) * @dlist_idx Number of devices entered on the command line. *************************************************************************** */ -void presave_device_list(int iodev_nr, int dlist_idx) +void presave_device_list(int iodev_nr, int *dlist_idx) { int i; struct io_hdr_stats *shi = st_hdr_iodev; struct io_dlist *sdli = st_dev_list; - if (dlist_idx>0) { + if (*dlist_idx > 0) { /* First, save the last group name entered on the command line in the list */ - update_dev_list(&dlist_idx, group_name); + update_dev_list(dlist_idx, group_name); /* Now save devices and group names in the io_hdr_stats structures */ - for (i = 0; (i < dlist_idx) && (i < iodev_nr); i++, shi++, sdli++) { + for (i = 0; (i < *dlist_idx) && (i < iodev_nr); i++, shi++, sdli++) { strncpy(shi->name, sdli->dev_name, MAX_NAME_LEN); shi->name[MAX_NAME_LEN - 1] = '\0'; shi->used = TRUE; @@ -2275,7 +2275,7 @@ int main(int argc, char **argv) * If groups of devices have been defined * then save devices and groups in the list. */ - presave_device_list(iodev_nr, dlist_idx); + presave_device_list(iodev_nr, &dlist_idx); } get_localtime(&rectime, 0); -- 2.40.0