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
This commit is contained in:
fanquake 2020-06-08 19:35:57 +08:00 committed by pasta
parent be35f1bc67
commit 87f1f84068
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

View File

@ -1344,8 +1344,9 @@ void ScheduleBatchPriority()
{
#ifdef SCHED_BATCH
const static sched_param param{};
if (pthread_setschedparam(pthread_self(), SCHED_BATCH, &param) != 0) {
LogPrintf("Failed to pthread_setschedparam: %s\n", strerror(errno));
const int rc = pthread_setschedparam(pthread_self(), SCHED_BATCH, &param);
if (rc != 0) {
LogPrintf("Failed to pthread_setschedparam: %s\n", strerror(rc));
}
#endif
}