plugin_seqthink: include fcntl.h for _O_BINARY under MinGW
MinGW-w64 does not pull _O_BINARY in via io.h alone; the Windows leg died on the binary-stdio block every plugin needs (lesson bh: MinGW text-mode stdout emits CR CR LF and breaks CGI framing). Also keep struct stat POSIX-only where it is used.
AuthorPico <picobot@scorpioplayer.com>
Date2026-11-13 20:34:34
Commitabbd49b0
Parentsc674b7d7
Changed files
src/plugin_seqthink.c+3−0■■■
1 file+3−0
Diff
src/plugin_seqthink.c+3−0■■■
index abc92d1..0b46868 100644
--- a/src/plugin_seqthink.c
+++ b/src/plugin_seqthink.c
@@ -78,6 +78,7 @@
7878 #if defined(_WIN32)
7979 # include <windows.h>
8080 # include <io.h>
81+# include <fcntl.h> /* _O_BINARY, _setmode, _fileno */
8182 # include <direct.h>
8283 # include <string.h>
8384 # ifndef strncasecmp
@@ -361,7 +362,9 @@ static void require_node_auth(void)
361362 static void state_dir(char *out, size_t outsz)
362363 {
363364 const char *env = getenv("SEQTHINK_STATE_DIR");
365+#ifndef _WIN32
364366 struct stat st;
367+#endif
365368
366369 if (env && *env) { snprintf(out, outsz, "%s", env); return; }
367370 #ifndef _WIN32
368371
src/plugin_seqthink.c+3−0■■■
index abc92d1..0b46868 100644index abc92d1..0b46868 100644
--- a/src/plugin_seqthink.c--- a/src/plugin_seqthink.c
+++ b/src/plugin_seqthink.c+++ b/src/plugin_seqthink.c
@@ -78,6 +78,7 @@@@ -78,6 +78,7 @@
78 #if defined(_WIN32)78 #if defined(_WIN32)
79 # include <windows.h>79 # include <windows.h>
80 # include <io.h>80 # include <io.h>
81+# include <fcntl.h> /* _O_BINARY, _setmode, _fileno */
81 # include <direct.h>82 # include <direct.h>
82 # include <string.h>83 # include <string.h>
83 # ifndef strncasecmp84 # ifndef strncasecmp
@@ -361,7 +362,9 @@ static void require_node_auth(void)@@ -361,7 +362,9 @@ static void require_node_auth(void)
361 static void state_dir(char *out, size_t outsz)362 static void state_dir(char *out, size_t outsz)
362 {363 {
363 const char *env = getenv("SEQTHINK_STATE_DIR");364 const char *env = getenv("SEQTHINK_STATE_DIR");
365+#ifndef _WIN32
364 struct stat st;366 struct stat st;
367+#endif
365 368
366 if (env && *env) { snprintf(out, outsz, "%s", env); return; }369 if (env && *env) { snprintf(out, outsz, "%s", env); return; }
367 #ifndef _WIN32370 #ifndef _WIN32
368371