From 494e82000f5f904db836ca5bad10e69f6edf9549 Mon Sep 17 00:00:00 2001 From: Hiroshi Saito Date: Wed, 6 May 2009 12:43:53 +0000 Subject: [PATCH] Fixed adjustment of a WSAStartup position problem. It happen the hostname problem in the service start. Per report Sachin Srivastava. and, thanks suggestions of Marko. --- win32/win32support.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/win32/win32support.c b/win32/win32support.c index 27355f5..e99d51a 100644 --- a/win32/win32support.c +++ b/win32/win32support.c @@ -61,16 +61,11 @@ static void usage(int err, char *exe) static int exec_real_main(int argc, char *argv[]) { int i, j; - WSADATA wsaData; /* win32 stdio seems to be fully buffered by default */ setvbuf(stdout, NULL, _IONBF, 0); setvbuf(stderr, NULL, _IONBF, 0); - /* initialize socket subsystem */ - if (WSAStartup(MAKEWORD(2,0), &wsaData)) - fatal("Cannot start the network subsystem"); - /* check if regular arguments are in allowed list */ for (i = 1; i < argc; i++) { char *p = argv[i]; @@ -351,6 +346,12 @@ static void win32_load_config(char *conf) #undef main int main(int argc, char *argv[]) { + WSADATA wsaData; + + /* initialize socket subsystem */ + if (WSAStartup(MAKEWORD(2,0), &wsaData)) + fatal("Cannot start the network subsystem"); + /* service cmdline */ if (argc == 3) { if (!strcmp(argv[1], "-service")) { -- 2.40.0