Mercurial > hg > nnchat
comparison main.c @ 707:11eb7c30889e
Adjust to fit new th_ioctx API.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 10 Mar 2020 17:01:22 +0200 |
parents | 4426bbf3264b |
children | 84d7b33c4e83 |
comparison
equal
deleted
inserted
replaced
706:4426bbf3264b | 707:11eb7c30889e |
---|---|
1276 printMsgQ(currWin, "Could not create configuration file directory '%s'.\n", | 1276 printMsgQ(currWin, "Could not create configuration file directory '%s'.\n", |
1277 setConfigDir); | 1277 setConfigDir); |
1278 goto error; | 1278 goto error; |
1279 } | 1279 } |
1280 | 1280 |
1281 if ((ctx = th_io_new(&th_stdio_io_ops, setConfigFile)) == NULL) | 1281 if ((ctx = th_io_new(&th_stdio_io_ops, setConfigFile, "w")) == NULL) |
1282 { | 1282 { |
1283 printMsgQ(currWin, "Could not initialize I/O context for configuration file writing!\n"); | 1283 printMsgQ(currWin, "Could not initialize I/O context for configuration file writing!\n"); |
1284 goto error; | 1284 goto error; |
1285 } | 1285 } |
1286 | 1286 |
1291 0 | 1291 0 |
1292 #else | 1292 #else |
1293 S_IRUSR | S_IWUSR | 1293 S_IRUSR | S_IWUSR |
1294 #endif | 1294 #endif |
1295 )) == -1 || | 1295 )) == -1 || |
1296 (ctx->data = (void *) fdopen(cfgfd, "w")) == NULL) | 1296 (ctx->data = (void *) fdopen(cfgfd, ctx->mode)) == NULL) |
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': %s\n", |
1300 ctx->filename, err, th_error_str(err)); | 1300 ctx->filename, th_error_str(err)); |
1301 goto error; | 1301 goto error; |
1302 } | 1302 } |
1303 | 1303 |
1304 printMsgQ(currWin, "Configuration saved in file '%s', res=%d\n", | 1304 printMsgQ(currWin, "Configuration saved in file '%s', res=%d\n", |
1305 ctx->filename, th_cfg_write(ctx, cfg)); | 1305 ctx->filename, th_cfg_write(ctx, cfg)); |