提交 e34c028a 编写于 作者: H Huaqiang 提交者: Michal Privoznik

virresctrl: Sort resctrl array correctly in virResctrlMonitorGetStats()

The qsort element is a pointer of virResctrlMonitorStats, and
the comparing function's arguments have a type of pointer of
virResctrlMonitorStatsPtr.
Signed-off-by: NHuaqiang <huaqiang.wang@intel.com>
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 d55be922
......@@ -2659,8 +2659,8 @@ static int
virResctrlMonitorStatsSorter(const void *a,
const void *b)
{
return ((virResctrlMonitorStatsPtr)a)->id
- ((virResctrlMonitorStatsPtr)b)->id;
return (*(virResctrlMonitorStatsPtr *)a)->id
- (*(virResctrlMonitorStatsPtr *)b)->id;
}
......@@ -2758,7 +2758,7 @@ virResctrlMonitorGetStats(virResctrlMonitorPtr monitor,
/* Sort in id's ascending order */
if (*nstats)
qsort(*stats, *nstats, sizeof(*stat), virResctrlMonitorStatsSorter);
qsort(*stats, *nstats, sizeof(**stats), virResctrlMonitorStatsSorter);
ret = 0;
cleanup:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册