Skip to content

Commit 50729c0

Browse files
committed
Merge bitcoin/bitcoin#29910: refactor: Rename subprocess.hpp to follow our header name conventions
08f756b Replace locale-dependent `std::strerror` with `SysErrorString` (Hennadii Stepanov) d8e4ba4 refactor: Rename `subprocess.hpp` to follow our header name conventions (Hennadii Stepanov) Pull request description: This PR renames the header `*.hpp` --> `*.h` and adjusts the header guard name, which makes it available for processing by linters. Fixed the following linter warning: ``` The locale dependent function strerror(...) appears to be used: src/util/subprocess.h: std::runtime_error( err_msg + ": " + std::strerror(err_code) ) Unnecessary locale dependence can cause bugs that are very tricky to isolate and fix. Please avoid using locale-dependent functions if possible. Advice not applicable in this specific case? Add an exception by updating the ignore list in /bitcoin/test/lint/lint-locale-dependence.py ^---- failure generated from lint-locale-dependence.py ``` ACKs for top commit: TheCharlatan: ACK 08f756b Tree-SHA512: 57a2f01c20eb9552481e428a4969bd59e9ada9f784fe1a45cb62aa9c9152c8e950d336854f45af0e2e5dc7c7b2a1fb216c8f832e3d6ccfb457ad71b6e423231e
2 parents d822d4e + 08f756b commit 50729c0

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

src/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ BITCOIN_CORE_H = \
320320
util/sock.h \
321321
util/spanparsing.h \
322322
util/string.h \
323-
util/subprocess.hpp \
323+
util/subprocess.h \
324324
util/syserror.h \
325325
util/task_runner.h \
326326
util/thread.h \

src/common/run_command.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <univalue.h>
1313

1414
#ifdef ENABLE_EXTERNAL_SIGNER
15-
#include <util/subprocess.hpp>
15+
#include <util/subprocess.h>
1616
#endif // ENABLE_EXTERNAL_SIGNER
1717

1818
UniValue RunCommandParseJSON(const std::string& str_command, const std::string& str_std_in)

src/test/system_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <univalue.h>
1212

1313
#ifdef ENABLE_EXTERNAL_SIGNER
14-
#include <util/subprocess.hpp>
14+
#include <util/subprocess.h>
1515
#endif // ENABLE_EXTERNAL_SIGNER
1616

1717
#include <boost/test/unit_test.hpp>

src/util/subprocess.hpp renamed to src/util/subprocess.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ Documentation for C++ subprocessing library.
3333
@version 1.0.0
3434
*/
3535

36-
#ifndef SUBPROCESS_HPP
37-
#define SUBPROCESS_HPP
36+
#ifndef BITCOIN_UTIL_SUBPROCESS_H
37+
#define BITCOIN_UTIL_SUBPROCESS_H
38+
39+
#include <util/syserror.h>
3840

3941
#include <algorithm>
4042
#include <cassert>
@@ -150,7 +152,7 @@ class OSError: public std::runtime_error
150152
{
151153
public:
152154
OSError(const std::string& err_msg, int err_code):
153-
std::runtime_error( err_msg + ": " + std::strerror(err_code) )
155+
std::runtime_error(err_msg + ": " + SysErrorString(err_code))
154156
{}
155157
};
156158

@@ -1609,4 +1611,4 @@ namespace detail {
16091611

16101612
}
16111613

1612-
#endif // SUBPROCESS_HPP
1614+
#endif // BITCOIN_UTIL_SUBPROCESS_H

0 commit comments

Comments
 (0)