From c6e87387978e4b389d4e514d698279b87e60b20d Mon Sep 17 00:00:00 2001 From: Subha sree Mohankumar Date: Wed, 15 Nov 2017 15:17:00 +0530 Subject: libglusterfs:checked return coverity fix Problem:Calling "gf_thread_create" without checking return value. Fix:The return value is saved and checked if gf_thread_create fails. Change-Id: Ibdaac1c90a1a8369e92ade50825598b041063da8 BUG: 789278 Signed-off-by: Subha sree Mohankumar --- libglusterfs/src/timer.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/timer.c b/libglusterfs/src/timer.c index 069fad188e2..64762bc050a 100644 --- a/libglusterfs/src/timer.c +++ b/libglusterfs/src/timer.c @@ -213,6 +213,7 @@ static gf_timer_registry_t * gf_timer_registry_init (glusterfs_ctx_t *ctx) { gf_timer_registry_t *reg = NULL; + int ret = -1; if (ctx == NULL) { gf_msg_callingfn ("timer", GF_LOG_ERROR, EINVAL, @@ -245,7 +246,13 @@ gf_timer_registry_init (glusterfs_ctx_t *ctx) INIT_LIST_HEAD (®->active); } UNLOCK (&ctx->lock); - gf_thread_create (®->th, NULL, gf_timer_proc, reg, "timer"); + ret = gf_thread_create (®->th, NULL, gf_timer_proc, reg, "timer"); + if (ret) { + gf_msg (THIS->name, GF_LOG_ERROR, ret, + LG_MSG_PTHREAD_FAILED, + "Thread creation failed"); + } + out: return reg; } -- cgit