修复Windows编译的问题。

将Windows CI单独拿出来。在Windows环境下编译需要在cmake的时候增加-DWIN32=ON参数。
This commit is contained in:
Simon
2024-04-20 12:23:30 +08:00
committed by GitHub
parent 6f870889cf
commit 350e91af0a
5 changed files with 59 additions and 5 deletions

View File

@@ -254,14 +254,21 @@ bad:
FD_ZERO(&fds);
FD_SET(conn.sock, &fds);
if (read_stdin)
#ifdef WIN32
FD_SET(_fileno, &fds);
#else
FD_SET(STDIN_FILENO, &fds);
#endif
if (select(conn.sock + 1, &fds, NULL, NULL, NULL) < 0) {
fprintf(stderr, "%s: select error\n", prog);
goto end;
}
#ifdef WIN32
if (read_stdin && FD_ISSET(_fileno, &fds)) {
#else
if (read_stdin && FD_ISSET(STDIN_FILENO, &fds)) {
#endif
if (fgets(buf, sizeof(buf), stdin)) {
if (tls_send(&conn, (uint8_t *)buf, strlen(buf), &len) != 1) {