From: Florian Forster Date: Fri, 1 Dec 2017 20:05:00 +0000 (+0100) Subject: exec plugin: Check return value of plugin_thread_create(). X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=1e021c689d6f316ec208443060a36b9638a0840a;p=collectd.git exec plugin: Check return value of plugin_thread_create(). CID: 37942, 37943 --- diff --git a/src/exec.c b/src/exec.c index 246584b7..60bd961e 100644 --- a/src/exec.c +++ b/src/exec.c @@ -800,7 +800,11 @@ static int exec_read(void) /* {{{ */ pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - plugin_thread_create(&t, &attr, exec_read_one, (void *)pl, "exec read"); + int status = + plugin_thread_create(&t, &attr, exec_read_one, (void *)pl, "exec read"); + if (status != 0) { + ERROR("exec plugin: plugin_thread_create failed."); + } pthread_attr_destroy(&attr); } /* for (pl) */ @@ -839,8 +843,11 @@ static int exec_notification(const notification_t *n, /* {{{ */ pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - plugin_thread_create(&t, &attr, exec_notification_one, (void *)pln, - "exec notify"); + int status = plugin_thread_create(&t, &attr, exec_notification_one, + (void *)pln, "exec notify"); + if (status != 0) { + ERROR("exec plugin: plugin_thread_create failed."); + } pthread_attr_destroy(&attr); } /* for (pl) */