]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Don't call disabled timer callbacks in event-test.c
authorMatthias Bolte <matthias.bolte@googlemail.com>
Tue, 26 Jan 2010 01:54:34 +0000 (02:54 +0100)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Tue, 26 Jan 2010 20:23:18 +0000 (21:23 +0100)
This fixes a segfault in the remote driver that occurs for example when
the event-test is run inside a domain-0 and libvirtd is also running.

examples/domain-events/events-c/event-test.c

index b506687505106854d17e962fa1e1c54c4b9413bb..b2eb1d5265955c5793ca3ac311bbfd0511946004 100644 (file)
@@ -335,9 +335,10 @@ int main(int argc, char **argv)
 
             sts = poll(&pfd, 1, TIMEOUT_MS);
 
-            /* We are assuming timeout of 0 here - so execute every time */
-            if(t_cb && t_active)
+            /* if t_timeout < 0 then t_cb must not be called */
+            if (t_cb && t_active && t_timeout >= 0) {
                 t_cb(t_timeout,t_opaque);
+            }
 
             if (sts == 0) {
                 /* DEBUG0("Poll timeout"); */