Skip to content

Commit 2ee53c6

Browse files
committed
order limits.h before stdlib.h to workaround for glibc fortify source issue
limits.h must be included before stdlib.h with glibc, otherwise the fortified realpath() in this module's stdlib will differ from the one in SwiftGlibc.
1 parent 072692c commit 2ee53c6

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Sources/_TestingInternals/include/Includes.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@
3939
#include <stdbool.h>
4040
#include <stdint.h>
4141
#include <stdio.h>
42+
#if __has_include(<limits.h>)
43+
/// limits.h must be included before stdlib.h with glibc, otherwise the
44+
/// fortified realpath() in this module will differ from the one in SwiftGlibc.
45+
#include <limits.h>
46+
#endif
4247
#include <stdlib.h>
4348
#include <string.h>
4449
#include <time.h>
@@ -97,10 +102,6 @@
97102
#include <pwd.h>
98103
#endif
99104

100-
#if __has_include(<limits.h>)
101-
#include <limits.h>
102-
#endif
103-
104105
#if __has_include(<spawn.h>)
105106
#include <spawn.h>
106107
#endif

0 commit comments

Comments
 (0)