From 3721efe1e9ba3cd09e03b8f2218551e2a6013b3d Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic <mmicko@gmail.com> Date: Mon, 11 Aug 2014 15:27:23 +0200 Subject: [PATCH] Make mongoose compile on mingw environment --- examples/Makefile | 19 ++++++++++++------- mongoose.c | 7 +++++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/examples/Makefile b/examples/Makefile index 99a584e50..bd14cebaf 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -11,13 +11,18 @@ NS = ../../net_skeleton SW = ../../ssl_wrapper ifeq ($(OS),Windows_NT) - MSVC = ../../vc6 - RM = del /q /f - OUT = - CC = $(MSVC)/bin/cl - CFLAGS = /MD /TC /nologo /W3 /I$(MSVC)/include /I.. - CFLAGS += /link /incremental:no /libpath:$(MSVC)/lib /machine:IX86 - CFLAGS += $(CFLAGS_EXTRA) + ifndef MINGW + MSVC = ../../vc6 + RM = del /q /f + OUT = + CC = $(MSVC)/bin/cl + CFLAGS = /MD /TC /nologo /W3 /I$(MSVC)/include /I.. + CFLAGS += /link /incremental:no /libpath:$(MSVC)/lib /machine:IX86 + CFLAGS += $(CFLAGS_EXTRA) + else + CC = g++ + CFLAGS = -W -Wall -Wno-unused-parameter -I.. -O0 -g -pipe $(CFLAGS_EXTRA) -lwsock32 + endif else UNAME_S := $(shell uname -s) CC = g++ diff --git a/mongoose.c b/mongoose.c index 2f6124844..467235518 100644 --- a/mongoose.c +++ b/mongoose.c @@ -1807,8 +1807,8 @@ static void abs_path(const char *utf8_path, char *abs_path, size_t len) { static process_id_t start_process(char *interp, const char *cmd, const char *env, const char *envp[], const char *dir, sock_t sock) { - STARTUPINFOW si = {0}; - PROCESS_INFORMATION pi = {0}; + STARTUPINFOW si; + PROCESS_INFORMATION pi; HANDLE a[2], b[2], me = GetCurrentProcess(); wchar_t wcmd[MAX_PATH_SIZE], full_dir[MAX_PATH_SIZE]; char buf[MAX_PATH_SIZE], buf4[MAX_PATH_SIZE], buf5[MAX_PATH_SIZE], @@ -1816,6 +1816,9 @@ static process_id_t start_process(char *interp, const char *cmd, DWORD flags = DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS; FILE *fp; + memset(&si, 0, sizeof(si)); + memset(&pi, 0, sizeof(pi)); + si.cb = sizeof(si); si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; si.wShowWindow = SW_HIDE; -- GitLab