From 7df7795b929c2c0911127d9fff64e62fe9e2975f Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Mon, 11 Jul 2016 00:00:00 -0500 Subject: [PATCH] vmstat: disallow 'disks' under that 'partition' switch Emulating the presumed proper behavior of the original program, when the -p switch is used we will now report an error if that provided name matches some disk name. Signed-off-by: Jim Warner --- vmstat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vmstat.c b/vmstat.c index 0b1d79a3..3c37ab54 100644 --- a/vmstat.c +++ b/vmstat.c @@ -479,8 +479,8 @@ static int diskpartition_format(const char *partition_name) if (procps_diskstat_read(disk_stat) < 0) xerr(EXIT_FAILURE, _("Unable to read diskstat")); - if ((partid = procps_diskstat_dev_getbyname(disk_stat, partition_name)) - < 0) + if ((partid = procps_diskstat_dev_getbyname(disk_stat, partition_name)) < 0 + || procps_diskstat_dev_isdisk(disk_stat, partid)) xerrx(EXIT_FAILURE, _("Partition %s not found"), partition_name); diskpartition_header(partition_name);