From 5abb9d50616d399914958b99352b8cf016e4928a Mon Sep 17 00:00:00 2001 From: David Teigland Date: Mar 09 2022 21:25:11 +0000 Subject: sanlock: fix pthread_create error check for non-zero rather than less than zero --- diff --git a/src/lockspace.c b/src/lockspace.c index d23dccd..582a0e9 100644 --- a/src/lockspace.c +++ b/src/lockspace.c @@ -1070,8 +1070,8 @@ int add_lockspace_start(struct sanlk_lockspace *ls, uint32_t io_timeout, struct (unsigned long long)sp->host_id_disk.offset); rv = pthread_create(&sp->thread, NULL, lockspace_thread, sp); - if (rv < 0) { - log_erros(sp, "add_lockspace create thread failed"); + if (rv) { + log_erros(sp, "add_lockspace create thread failed %d", rv); goto fail_del; } diff --git a/src/main.c b/src/main.c index 5b6fabc..613fb0e 100644 --- a/src/main.c +++ b/src/main.c @@ -995,7 +995,7 @@ static int thread_pool_add_work(struct cmd_args *ca) if (!pool.free_workers && pool.num_workers < pool.max_workers) { rv = pthread_create(&th, NULL, thread_pool_worker, (void *)(long)pool.num_workers); - if (rv < 0) { + if (rv) { log_error("thread_pool_add_work ci %d error %d", ca->ci_in, rv); list_del(&ca->list); pthread_mutex_unlock(&pool.mutex); @@ -1035,7 +1035,7 @@ static int thread_pool_create(int min_workers, int max_workers) for (i = 0; i < min_workers; i++) { rv = pthread_create(&th, NULL, thread_pool_worker, (void *)(long)i); - if (rv < 0) + if (rv) break; pool.num_workers++; }