aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMIZUTA Takeshi <mizuta.takeshi@fujitsu.com>2020-06-08 16:37:59 +0900
committerfanquake <fanquake@gmail.com>2020-10-16 08:06:13 +0800
commit27bb2cc3b6053f94b38934748127bc73f87618ad (patch)
treee8c4bc258ce480bdc73b6cb3bf86ab98e3d4d4d0
parent8bd2ab1f35f1b3f618fa801debf844eb164a2bd6 (diff)
downloadbitcoin-27bb2cc3b6053f94b38934748127bc73f87618ad.tar.xz
util: Don't reference errno when pthread fails.
Pthread library does not set errno. Pthread library's errno is returned by return value. Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Github-Pull: #19194 Rebased-From: cb38b069b0f41b1a26264784b1c1303c8ac6ab08
-rw-r--r--src/util/system.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/util/system.cpp b/src/util/system.cpp
index 5a3c68aa0c..db1d032916 100644
--- a/src/util/system.cpp
+++ b/src/util/system.cpp
@@ -1236,9 +1236,10 @@ int ScheduleBatchPriority()
{
#ifdef SCHED_BATCH
const static sched_param param{};
- if (int ret = pthread_setschedparam(pthread_self(), SCHED_BATCH, &param)) {
- LogPrintf("Failed to pthread_setschedparam: %s\n", strerror(errno));
- return ret;
+ const int rc = pthread_setschedparam(pthread_self(), SCHED_BATCH, &param);
+ if (rc != 0) {
+ LogPrintf("Failed to pthread_setschedparam: %s\n", strerror(rc));
+ return rc;
}
return 0;
#else