Skip to content

Commit 23a899b

Browse files
committed
Merge bitcoin/bitcoin#26832: compat: move (win) S_* defines into bdb
54e4061 refactor: don't avoid sys/types.h on when building for Windows (fanquake) Pull request description: This is the only place these defines are used. They may also be available when building for Windows. `sys/stat.h` is available, and we already use it unguarded in other code. So move the defines into bdb, after the stat.h include, and remove compat from bdb.cpp. ACKs for top commit: TheCharlatan: re-ACK 54e4061 hebasto: ACK 54e4061, I have reviewed the code and it looks OK. Tree-SHA512: b75bb120654b4dec9ccc83aa407ee1a50969fec92f196a3722ec51282b91ac50e455af04f07211f3e93270ab83660f1efdeef43928b44b1e4296f6b06ea807c8
2 parents 49b87bf + 54e4061 commit 23a899b

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

src/compat/compat.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,6 @@ typedef unsigned int SOCKET;
6262
#endif
6363
#endif
6464

65-
// Windows doesn't define S_IRUSR or S_IWUSR. We define both
66-
// here, with the same values as glibc (see stat.h).
67-
#ifdef WIN32
68-
#ifndef S_IRUSR
69-
#define S_IRUSR 0400
70-
#define S_IWUSR 0200
71-
#endif
72-
#endif
73-
7465
// Windows defines MAX_PATH as it's maximum path length.
7566
// We define MAX_PATH for use on non-Windows systems.
7667
#ifndef WIN32

src/randomenv.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@
2424
#include <thread>
2525
#include <vector>
2626

27+
#include <sys/types.h> // must go before a number of other headers
28+
2729
#ifdef WIN32
2830
#include <windows.h>
2931
#include <winreg.h>
3032
#else
31-
#include <sys/types.h> // must go before a number of other headers
3233
#include <fcntl.h>
3334
#include <netinet/in.h>
3435
#include <sys/resource.h>

src/test/util_tests.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@
3535
#include <univalue.h>
3636
#include <utility>
3737
#include <vector>
38+
39+
#include <sys/types.h>
40+
3841
#ifndef WIN32
3942
#include <signal.h>
40-
#include <sys/types.h>
4143
#include <sys/wait.h>
4244
#endif
4345

src/wallet/bdb.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,15 @@
1515

1616
#include <stdint.h>
1717

18-
#ifndef WIN32
1918
#include <sys/stat.h>
19+
20+
// Windows may not define S_IRUSR or S_IWUSR. We define both
21+
// here, with the same values as glibc (see stat.h).
22+
#ifdef WIN32
23+
#ifndef S_IRUSR
24+
#define S_IRUSR 0400
25+
#define S_IWUSR 0200
26+
#endif
2027
#endif
2128

2229
namespace wallet {

0 commit comments

Comments
 (0)