# HG changeset patch # User Matti Hamalainen # Date 1457532820 -7200 # Node ID c7a24acb36209a29ed863e7bf562e35ce6f60fc2 # Parent dd3083a3383df133b4988b625ebf7859c3c85a77 Fix Windows builds. diff -r dd3083a3383d -r c7a24acb3620 main.c --- 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",