diff --git a/src/tool_main.c b/src/tool_main.c index d6d8e9911a..8a2f4d6cbb 100644 --- a/src/tool_main.c +++ b/src/tool_main.c @@ -277,6 +277,11 @@ int main(int argc, char *argv[]) main_free(&global); } +#ifdef WIN32 + /* Flush buffers of all streams opened in write or update mode */ + fflush(NULL); +#endif + #ifdef __NOVELL_LIBC__ if(!getenv("_IN_NETWARE_BASH_")) tool_pressanykey(); diff --git a/tests/libtest/first.c b/tests/libtest/first.c index ffb211fd47..4ba0fab60b 100644 --- a/tests/libtest/first.c +++ b/tests/libtest/first.c @@ -179,5 +179,10 @@ int main(int argc, char **argv) PR_Cleanup(); #endif +#ifdef WIN32 + /* flush buffers of all streams regardless of mode */ + _flushall(); +#endif + return result; } diff --git a/tests/server/util.c b/tests/server/util.c index cfa8be2857..3b98e71660 100644 --- a/tests/server/util.c +++ b/tests/server/util.c @@ -159,11 +159,10 @@ void win32_perror(const char *msg) fprintf(stderr, "%s: ", msg); fprintf(stderr, "%s\n", buf); } -#endif /* WIN32 */ -#ifdef USE_WINSOCK void win32_init(void) { +#ifdef USE_WINSOCK WORD wVersionRequested; WSADATA wsaData; int err; @@ -184,14 +183,20 @@ void win32_init(void) logmsg("No suitable winsock.dll found -- aborting"); exit(1); } +#endif /* USE_WINSOCK */ } void win32_cleanup(void) { +#ifdef USE_WINSOCK WSACleanup(); -} #endif /* USE_WINSOCK */ + /* flush buffers of all streams regardless of their mode */ + _flushall(); +} +#endif /* WIN32 */ + /* set by the main code to point to where the test dir is */ const char *path = "."; diff --git a/tests/server/util.h b/tests/server/util.h index 140e349f38..ae05b59350 100644 --- a/tests/server/util.h +++ b/tests/server/util.h @@ -51,10 +51,10 @@ extern const char *cmdfile; void win32_perror(const char *msg); #endif /* WIN32 or _WIN32 */ -#ifdef USE_WINSOCK +#ifdef WIN32 void win32_init(void); void win32_cleanup(void); -#endif /* USE_WINSOCK */ +#endif /* WIN32 */ /* fopens the test case file */ FILE *test2fopen(long testno);