changeset 672:c7a24acb3620

Fix Windows builds.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 09 Mar 2016 16:13:40 +0200
parents dd3083a3383d
children 358cdc4c9178
files main.c
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/main.c	Wed Mar 09 15:09:59 2016 +0200
+++ b/main.c	Wed Mar 09 16:13:40 2016 +0200
@@ -1269,9 +1269,7 @@
     (void) conn;
     (void) buf;
     th_ioctx *ctx = NULL;
-#ifndef TH_PLAT_WINDOWS
     int cfgfd = -1;
-#endif
 
     if (!th_mkdir_path(setConfigDir, 0))
     {
@@ -1288,12 +1286,14 @@
 
     th_io_set_handlers(ctx, nn_ioctx_errfunc, nn_ioctx_msgfunc);
 
+    if ((cfgfd = open(ctx->filename, O_CREAT | O_TRUNC | O_WRONLY,
 #ifdef TH_PLAT_WINDOWS
-    if ((ctx->fp = fopen(ctx->filename, "w")) == NULL)
+        0
 #else
-    if ((cfgfd = open(ctx->filename, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR)) == -1 ||
+        S_IRUSR | S_IWUSR
+#endif
+        )) == -1 ||
         (ctx->data = (void *) fdopen(cfgfd, "w")) == NULL)
-#endif
     {
         int err = th_get_error();
         printMsgQ(currWin, "Could not create configuration to file '%s', %d: %s\n",