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 <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2016-07-11 00:00:00 -05:00 committed by Craig Small
parent dfedcdd883
commit 7df7795b92

View File

@ -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);