[libvirt] [PATCH] Don't call disabled timer callbacks in event-test.c

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 | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/domain-events/events-c/event-test.c b/examples/domain-events/events-c/event-test.c index b506687..b2eb1d5 100644 --- a/examples/domain-events/events-c/event-test.c +++ b/examples/domain-events/events-c/event-test.c @@ -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"); */ -- 1.6.3.3

On Tue, Jan 26, 2010 at 03:20:38AM +0100, Matthias Bolte wrote:
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 | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/examples/domain-events/events-c/event-test.c b/examples/domain-events/events-c/event-test.c index b506687..b2eb1d5 100644 --- a/examples/domain-events/events-c/event-test.c +++ b/examples/domain-events/events-c/event-test.c @@ -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"); */ --
ACK Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

2010/1/26 Daniel P. Berrange <berrange@redhat.com>:
On Tue, Jan 26, 2010 at 03:20:38AM +0100, Matthias Bolte wrote:
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 | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/examples/domain-events/events-c/event-test.c b/examples/domain-events/events-c/event-test.c index b506687..b2eb1d5 100644 --- a/examples/domain-events/events-c/event-test.c +++ b/examples/domain-events/events-c/event-test.c @@ -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"); */ --
ACK
Daniel
Thanks, pushed. Matthias
participants (2)
-
Daniel P. Berrange
-
Matthias Bolte