diff options
author | Subha sree Mohankumar <smohanku@redhat.com> | 2017-11-15 15:17:00 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2017-11-21 06:34:50 +0000 |
commit | c6e87387978e4b389d4e514d698279b87e60b20d (patch) | |
tree | 78ddb6eb7b38e81812ce60884214549ebb8626a8 /libglusterfs | |
parent | b8e80c2abfa84cd75172e7fb748a2b3114a60eba (diff) | |
download | glusterfs-c6e87387978e4b389d4e514d698279b87e60b20d.tar.gz glusterfs-c6e87387978e4b389d4e514d698279b87e60b20d.tar.xz glusterfs-c6e87387978e4b389d4e514d698279b87e60b20d.zip |
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 <smohanku@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/timer.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libglusterfs/src/timer.c b/libglusterfs/src/timer.c index 069fad188e..64762bc050 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; } |