HomePhabricator

util: Replace non-threadsafe strerror

Description

util: Replace non-threadsafe strerror

Summary:
Some uses of non-threadsafe strerror have snuck into the code since
they were removed in #4152. Add a wrapper SysErrorString for
thread-safe strerror alternatives and replace all uses of strerror
with this.

Add strerror to the locale-dependence linter to catch its use.
Add an exemption for strerror.cpp (the only allowed use).

Also fix a bug in the regexp so that _r and _s variants are detected
again.

This is a partial backport of core#24933
https://github.com/bitcoin/bitcoin/pull/24933/commits/46971c6dbfbc39ebbc74ab1ed8c00edc12859373
https://github.com/bitcoin/bitcoin/pull/24933/commits/e3a06a3c6cbb288ac89a2725cf71ae8adaebf35c
Depends on D16208 and D16212

Test Plan:
ninja all check-all

Check that the linter catches occurences of strerror

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D16209

Details

Provenance
laanwj <126646+laanwj@users.noreply.github.com>Authored on Apr 20 2022, 14:17
PiRKCommitted on May 23 2024, 19:11
PiRKPushed on May 23 2024, 19:11
Reviewer
Restricted Project
Differential Revision
D16209: util: Replace non-threadsafe strerror
Parents
rABC175e03b01a8c: refactor: Move ScheduleBatchPriority to its own file
Branches
Unknown
Tags
Unknown

Event Timeline