Skip to content

Commit 9c45399

Browse files
committed
Fix lto, strncpy
1 parent 71a6400 commit 9c45399

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

build.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
int main(int argc, char **argv) {
44
/* Some variables we need */
5-
char *CXXFLAGS = strcpy(calloc(1024, 1), maybe(getenv("CXXFLAGS")));
6-
char *CFLAGS = strcpy(calloc(1024, 1), maybe(getenv("CFLAGS")));
7-
char *LDFLAGS = strcpy(calloc(1024, 1), maybe(getenv("LDFLAGS")));
8-
char *CC = strcpy(calloc(1024, 1), or_else(getenv("CC"), "cc"));
9-
char *CXX = strcpy(calloc(1024, 1), or_else(getenv("CXX"), "g++"));
10-
char *EXEC_SUFFIX = strcpy(calloc(1024, 1), maybe(getenv("EXEC_SUFFIX")));
5+
char *CXXFLAGS = strncpy(calloc(1024, 1), maybe(getenv("CXXFLAGS")), 1024);
6+
char *CFLAGS = strncpy(calloc(1024, 1), maybe(getenv("CFLAGS")), 1024);
7+
char *LDFLAGS = strncpy(calloc(1024, 1), maybe(getenv("LDFLAGS")), 1024);
8+
char *CC = strncpy(calloc(1024, 1), or_else(getenv("CC"), "cc"), 1024);
9+
char *CXX = strncpy(calloc(1024, 1), or_else(getenv("CXX"), "g++"), 1024);
10+
char *EXEC_SUFFIX = strncpy(calloc(1024, 1), maybe(getenv("EXEC_SUFFIX")), 1024);
1111

1212
char *EXAMPLE_FILES[] = {"EchoBody", "HelloWorldThreaded", "Http3Server", "Broadcast", "HelloWorld", "Crc32", "ServerName",
1313
"EchoServer", "BroadcastingEchoServer", "UpgradeSync", "UpgradeAsync", "ParameterRoutes"};
@@ -17,7 +17,7 @@ int main(int argc, char **argv) {
1717

1818
// By default we use LTO, but Windows does not support it
1919
if (!env_is("WITH_LTO", "0")) {
20-
strcat(CXXFLAGS, " -flto");
20+
strcat(CXXFLAGS, " -flto=auto");
2121
}
2222

2323
// By default we use zlib but you can build without it (disables permessage-deflate)

0 commit comments

Comments
 (0)