Skip to content

Commit cb38b06

Browse files
miztakehebasto
andcommitted
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 <[email protected]>
1 parent b1b1739 commit cb38b06

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/util/system.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,8 +1163,9 @@ void ScheduleBatchPriority()
11631163
{
11641164
#ifdef SCHED_BATCH
11651165
const static sched_param param{};
1166-
if (pthread_setschedparam(pthread_self(), SCHED_BATCH, &param) != 0) {
1167-
LogPrintf("Failed to pthread_setschedparam: %s\n", strerror(errno));
1166+
const int rc = pthread_setschedparam(pthread_self(), SCHED_BATCH, &param);
1167+
if (rc != 0) {
1168+
LogPrintf("Failed to pthread_setschedparam: %s\n", strerror(rc));
11681169
}
11691170
#endif
11701171
}

0 commit comments

Comments
 (0)