diff --git a/src/bio.c b/src/bio.c index d0d95753f7..251ec62bce 100644 --- a/src/bio.c +++ b/src/bio.c @@ -152,8 +152,9 @@ void bioInit(void) { * responsible for. */ for (j = 0; j < BIO_WORKER_NUM; j++) { void *arg = (void *)(unsigned long)j; - if (pthread_create(&thread, &attr, bioProcessBackgroundJobs, arg) != 0) { - serverLog(LL_WARNING, "Fatal: Can't initialize Background Jobs. Error message: %s", strerror(errno)); + int err = pthread_create(&thread, &attr, bioProcessBackgroundJobs, arg); + if (err) { + serverLog(LL_WARNING, "Fatal: Can't initialize Background Jobs. Error message: %s", strerror(err)); exit(1); } bio_threads[j] = thread; @@ -239,8 +240,9 @@ void *bioProcessBackgroundJobs(void *arg) { * receive the watchdog signal. */ sigemptyset(&sigset); sigaddset(&sigset, SIGALRM); - if (pthread_sigmask(SIG_BLOCK, &sigset, NULL)) - serverLog(LL_WARNING, "Warning: can't mask SIGALRM in bio.c thread: %s", strerror(errno)); + int err = pthread_sigmask(SIG_BLOCK, &sigset, NULL); + if (err) + serverLog(LL_WARNING, "Warning: can't mask SIGALRM in bio.c thread: %s", strerror(err)); bio_thread_id = worker; diff --git a/src/io_threads.c b/src/io_threads.c index 5aec59dceb..231cf6158b 100644 --- a/src/io_threads.c +++ b/src/io_threads.c @@ -269,8 +269,9 @@ static void createIOThread(int id) { pthread_mutex_init(&io_threads_mutex[id], NULL); IOJobQueue_init(&io_jobs[id], IO_JOB_QUEUE_SIZE); pthread_mutex_lock(&io_threads_mutex[id]); /* Thread will be stopped. */ - if (pthread_create(&tid, NULL, IOThreadMain, (void *)(long)id) != 0) { - serverLog(LL_WARNING, "Fatal: Can't initialize IO thread, pthread_create failed with: %s", strerror(errno)); + int err = pthread_create(&tid, NULL, IOThreadMain, (void *)(long)id); + if (err) { + serverLog(LL_WARNING, "Fatal: Can't initialize IO thread, pthread_create failed with: %s", strerror(err)); exit(1); } io_threads[id] = tid;