Mercurial > hg > nnchat
comparison main.c @ 672:c7a24acb3620
Fix Windows builds.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 09 Mar 2016 16:13:40 +0200 |
parents | 06199003043a |
children | f40d5613c753 |
comparison
equal
deleted
inserted
replaced
671:dd3083a3383d | 672:c7a24acb3620 |
---|---|
1267 int nncmd_save_config(th_conn_t *conn, char *buf) | 1267 int nncmd_save_config(th_conn_t *conn, char *buf) |
1268 { | 1268 { |
1269 (void) conn; | 1269 (void) conn; |
1270 (void) buf; | 1270 (void) buf; |
1271 th_ioctx *ctx = NULL; | 1271 th_ioctx *ctx = NULL; |
1272 #ifndef TH_PLAT_WINDOWS | |
1273 int cfgfd = -1; | 1272 int cfgfd = -1; |
1274 #endif | |
1275 | 1273 |
1276 if (!th_mkdir_path(setConfigDir, 0)) | 1274 if (!th_mkdir_path(setConfigDir, 0)) |
1277 { | 1275 { |
1278 printMsgQ(currWin, "Could not create configuration file directory '%s'.\n", | 1276 printMsgQ(currWin, "Could not create configuration file directory '%s'.\n", |
1279 setConfigDir); | 1277 setConfigDir); |
1286 goto error; | 1284 goto error; |
1287 } | 1285 } |
1288 | 1286 |
1289 th_io_set_handlers(ctx, nn_ioctx_errfunc, nn_ioctx_msgfunc); | 1287 th_io_set_handlers(ctx, nn_ioctx_errfunc, nn_ioctx_msgfunc); |
1290 | 1288 |
1289 if ((cfgfd = open(ctx->filename, O_CREAT | O_TRUNC | O_WRONLY, | |
1291 #ifdef TH_PLAT_WINDOWS | 1290 #ifdef TH_PLAT_WINDOWS |
1292 if ((ctx->fp = fopen(ctx->filename, "w")) == NULL) | 1291 0 |
1293 #else | 1292 #else |
1294 if ((cfgfd = open(ctx->filename, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR)) == -1 || | 1293 S_IRUSR | S_IWUSR |
1294 #endif | |
1295 )) == -1 || | |
1295 (ctx->data = (void *) fdopen(cfgfd, "w")) == NULL) | 1296 (ctx->data = (void *) fdopen(cfgfd, "w")) == NULL) |
1296 #endif | |
1297 { | 1297 { |
1298 int err = th_get_error(); | 1298 int err = th_get_error(); |
1299 printMsgQ(currWin, "Could not create configuration to file '%s', %d: %s\n", | 1299 printMsgQ(currWin, "Could not create configuration to file '%s', %d: %s\n", |
1300 ctx->filename, err, th_error_str(err)); | 1300 ctx->filename, err, th_error_str(err)); |
1301 goto error; | 1301 goto error; |