Changeset: e3f3f7c48a48 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e3f3f7c48a48
Modified Files:
tools/mserver/mserver5.c
Branch: Jul2015
Log Message:
On Windows, don't exit when a function is called with invalid parameters.
In particular, this affected calls to strftime with an invalid format
string.
diffs (50 lines):
diff --git a/tools/mserver/mserver5.c b/tools/mserver/mserver5.c
--- a/tools/mserver/mserver5.c
+++ b/tools/mserver/mserver5.c
@@ -36,6 +36,7 @@
#ifdef _MSC_VER
#include <Psapi.h> /* for GetModuleFileName */
+#include <crtdbg.h> /* for _CRT_ERROR, _CRT_ASSERT */
#endif
#ifdef _CRTDBG_MAP_ALLOC
@@ -67,6 +68,26 @@ mserver_abort()
}
#endif
+#ifdef _MSC_VER
+static void
+mserver_invalid_parameter_handler(
+ const wchar_t *expression,
+ const wchar_t *function,
+ const wchar_t *file,
+ unsigned int line,
+ uintptr_t reserved)
+{
+ (void) expression;
+ (void) function;
+ (void) file;
+ (void) line;
+ (void) reserved;
+ /* the essential bit of this function is that it returns:
+ * we don't want the server to quit when a function is called
+ * with an invalid parameter */
+}
+#endif
+
__declspec(noreturn) static void usage(char *prog, int xit)
__attribute__((__noreturn__));
@@ -261,6 +282,11 @@ main(int argc, char **av)
#if defined(_MSC_VER) && defined(__cplusplus)
set_terminate(mserver_abort);
#endif
+#ifdef _MSC_VER
+ _CrtSetReportMode(_CRT_ERROR, 0);
+ _CrtSetReportMode(_CRT_ASSERT, 0);
+ _set_invalid_parameter_handler(mserver_invalid_parameter_handler);
+#endif
if (setlocale(LC_CTYPE, "") == NULL) {
GDKfatal("cannot set locale\n");
}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list