]> xenbits.xensource.com Git - libvirt.git/commitdiff
node_device_udev: Test for mdevctlTimeout != -1
authorMarc Hartmayer <mhartmay@linux.ibm.com>
Tue, 23 Apr 2024 18:08:52 +0000 (20:08 +0200)
committerJonathon Jongsma <jjongsma@redhat.com>
Tue, 18 Jun 2024 14:00:16 +0000 (09:00 -0500)
It is done a little differently everywhere in libvirt, but most common is to
test for != -1.

Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
src/node_device/node_device_udev.c

index 5cf4fbbfc21433ec2461464ace89cdf04ad1b83c..3e3c20a6d4d1604fd25b48bb38a434e2bd1b7455 100644 (file)
@@ -88,7 +88,7 @@ udevEventDataDispose(void *obj)
     if (priv->watch != -1)
         virEventRemoveHandle(priv->watch);
 
-    if (priv->mdevctlTimeout > 0)
+    if (priv->mdevctlTimeout != -1)
         virEventRemoveTimeout(priv->mdevctlTimeout);
 
     if (!priv->udev_monitor)
@@ -139,6 +139,7 @@ udevEventDataNew(void)
         return NULL;
     }
 
+    ret->mdevctlTimeout = -1;
     ret->watch = -1;
     return ret;
 }
@@ -2082,7 +2083,7 @@ launchMdevctlUpdateThread(int timer G_GNUC_UNUSED, void *opaque)
     udevEventData *priv = opaque;
     virThread thread;
 
-    if (priv->mdevctlTimeout > 0) {
+    if (priv->mdevctlTimeout != -1) {
         virEventRemoveTimeout(priv->mdevctlTimeout);
         priv->mdevctlTimeout = -1;
     }
@@ -2192,7 +2193,7 @@ scheduleMdevctlUpdate(udevEventData *data,
                       bool force)
 {
     if (!force) {
-        if (data->mdevctlTimeout > 0)
+        if (data->mdevctlTimeout != -1)
             virEventRemoveTimeout(data->mdevctlTimeout);
         data->mdevctlTimeout = virEventAddTimeout(100, launchMdevctlUpdateThread,
                                                   data, NULL);