From 87f1f84068ea04cfa5c664fff02a83ed397ea2bf Mon Sep 17 00:00:00 2001 From: fanquake Date: Mon, 8 Jun 2020 19:35:57 +0800 Subject: [PATCH] Merge #19194: util: Don't reference errno when pthread fails. cb38b069b0f41b1a26264784b1c1303c8ac6ab08 util: Don't reference errno when pthread fails. (MIZUTA Takeshi) Pull request description: Pthread library does not set errno. Pthread library's errno is returned by return value. ACKs for top commit: practicalswift: ACK cb38b069b0f41b1a26264784b1c1303c8ac6ab08 -- patch looks correct MarcoFalke: review ACK cb38b069b0f41b1a26264784b1c1303c8ac6ab08 hebasto: ACK cb38b069b0f41b1a26264784b1c1303c8ac6ab08, only squashed commits since the [previous](https://github.com/bitcoin/bitcoin/pull/19194#pullrequestreview-425831739) review. Tree-SHA512: e6c950e30726e5031db97a7b84c8a9215da5ad3e5d233bcc349f812ad15957ddfe378e26d18339b9e0a5dcac2f50b47a687b87a6a6beaf6139df84f31531321e --- src/util/system.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util/system.cpp b/src/util/system.cpp index 5eef0abf75..387b27a187 100644 --- a/src/util/system.cpp +++ b/src/util/system.cpp @@ -1344,8 +1344,9 @@ void ScheduleBatchPriority() { #ifdef SCHED_BATCH const static sched_param param{}; - if (pthread_setschedparam(pthread_self(), SCHED_BATCH, ¶m) != 0) { - LogPrintf("Failed to pthread_setschedparam: %s\n", strerror(errno)); + const int rc = pthread_setschedparam(pthread_self(), SCHED_BATCH, ¶m); + if (rc != 0) { + LogPrintf("Failed to pthread_setschedparam: %s\n", strerror(rc)); } #endif }