On 12/26/2010 11:29 PM, Hu Tao wrote:
Do nothing if caller passes NULL as jobdata to
virThreadPoolSendJob().
---
src/util/threadpool.c | 3 +++
src/util/threadpool.h | 1 -
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/util/threadpool.c b/src/util/threadpool.c
index 1213862..2907478 100644
--- a/src/util/threadpool.c
+++ b/src/util/threadpool.c
@@ -192,6 +192,9 @@ int virThreadPoolSendJob(virThreadPoolPtr pool,
{
virThreadPoolJobPtr job;
+ if (!jobData)
+ return -1;
+
This hunk is wrong. jobData is opaque - we cannot assume anything about
it's meaning. A job may very well have something to do even with a NULL
job data, and refusing to run a job just because one of its two opaque
arguments is NULL is no better than marking the parameter as
ATTRIBUTE_NONNULL when registering the job.
+++ b/src/util/threadpool.h
@@ -42,7 +42,6 @@ void virThreadPoolFree(virThreadPoolPtr pool);
int virThreadPoolSendJob(virThreadPoolPtr pool,
void *jobdata) ATTRIBUTE_NONNULL(1)
- ATTRIBUTE_NONNULL(2)
ATTRIBUTE_RETURN_CHECK;
But this hunk is okay. I've applied just this hunk, as it is
technically a bug fix (over-strict compilation markings), and minimal
impact for inclusion in 0.8.7.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org