Skip to content

Instantly share code, notes, and snippets.

@ant32
Created January 28, 2015 22:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ant32/41a28b552c7405a55ab9 to your computer and use it in GitHub Desktop.
Save ant32/41a28b552c7405a55ab9 to your computer and use it in GitHub Desktop.
mingw-w64-libmariadbclient not working on Windows XP becuase of missing fopen_s in msvcrt.dll
--- libmariadb/dbug.c 2014-04-04 04:21:01.000000000 -0600
+++ libmariadb/dbug.c 2015-01-24 16:47:13.316693150 -0700
@@ -2050,11 +2050,7 @@
}
else
{
-#ifdef _WIN32
- if (fopen_s(&fp, name, append ? "a+" : "w"))
-#else
if (!(fp= fopen(name, append ? "a+" : "w")))
-#endif
{
(void) fprintf(stderr, ERR_OPEN, cs->process, name);
perror("");
--- libmariadb/my_fopen.c 2014-04-04 04:21:01.000000000 -0600
+++ libmariadb/my_fopen.c 2015-01-24 16:46:10.735766900 -0700
@@ -36,11 +36,7 @@
FileName, Flags, MyFlags));
make_ftype(type,Flags);
-#ifdef _WIN32
- if (fopen_s(&fd, FileName, type) == 0)
-#else
if ((fd = fopen(FileName, type)) != 0)
-#endif
{
/*
The test works if MY_NFILE < 128. The problem is that fileno() is char
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment