]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: Check/ignore already disabled event
authorJohn Ferlan <jferlan@redhat.com>
Fri, 7 Oct 2016 12:28:58 +0000 (08:28 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Fri, 7 Oct 2016 17:27:21 +0000 (13:27 -0400)
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.

src/util/virperf.c

index 638743098b194fb3631b51e84ed05e8a4d4ae633..5d57962442e9d110140a72a69aa5366797c95754 100644 (file)
@@ -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"),