diff options
author | MIZUTA Takeshi <mizuta.takeshi@fujitsu.com> | 2020-06-08 16:37:59 +0900 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2020-10-16 08:06:13 +0800 |
commit | 27bb2cc3b6053f94b38934748127bc73f87618ad (patch) | |
tree | e8c4bc258ce480bdc73b6cb3bf86ab98e3d4d4d0 | |
parent | 8bd2ab1f35f1b3f618fa801debf844eb164a2bd6 (diff) | |
download | bitcoin-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.cpp | 7 |
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, ¶m)) { - LogPrintf("Failed to pthread_setschedparam: %s\n", strerror(errno)); - return ret; + const int rc = pthread_setschedparam(pthread_self(), SCHED_BATCH, ¶m); + if (rc != 0) { + LogPrintf("Failed to pthread_setschedparam: %s\n", strerror(rc)); + return rc; } return 0; #else |