From: John Ferlan Date: Fri, 7 Oct 2016 12:28:58 +0000 (-0400) Subject: util: Check/ignore already disabled event X-Git-Tag: v2.4.0-rc1~183 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0f3f8ac97efed4a5c574e6b51e356cea2f825fcf;p=thirdparty%2Flibvirt.git util: Check/ignore already disabled event If the event is already disabled, then don't bother with setting it disabled again. Causes unnecessary error on systems that don't support the feature anyway. --- diff --git a/src/util/virperf.c b/src/util/virperf.c index 638743098b..5d57962442 100644 --- a/src/util/virperf.c +++ b/src/util/virperf.c @@ -234,6 +234,9 @@ virPerfEventDisable(virPerfPtr perf, if (event == NULL) return -1; + if (!event->enabled) + return 0; + if (ioctl(event->fd, PERF_EVENT_IOC_DISABLE) < 0) { virReportSystemError(errno, _("unable to disable host cpu perf event for %s"),