diff options
Diffstat (limited to 'src/tools/setconf.c')
-rw-r--r-- | src/tools/setconf.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/tools/setconf.c b/src/tools/setconf.c index c70edab..1857ff6 100644 --- a/src/tools/setconf.c +++ b/src/tools/setconf.c @@ -5,6 +5,7 @@ #include <stdlib.h> #include <string.h> +#include "containers.h" #include "config.h" #include "ipc.h" #include "subcommands.h" @@ -28,7 +29,7 @@ int setconf_main(int argc, char *argv[]) perror("fopen"); return 1; } - if (!config_read_init(&ctx, &device, !strcmp(argv[0], "addconf"))) { + if (!config_read_init(&ctx, !strcmp(argv[0], "addconf"))) { fclose(config_input); return 1; } @@ -38,12 +39,13 @@ int setconf_main(int argc, char *argv[]) goto cleanup; } } - if (!config_read_finish(&ctx) || !device) { + device = config_read_finish(&ctx); + if (!device) { fprintf(stderr, "Invalid configuration\n"); goto cleanup; } - strncpy(device->interface, argv[1], IFNAMSIZ - 1); - device->interface[IFNAMSIZ - 1] = 0; + strncpy(device->name, argv[1], IFNAMSIZ - 1); + device->name[IFNAMSIZ - 1] = 0; if (ipc_set_device(device) != 0) { perror("Unable to set device"); @@ -56,6 +58,6 @@ cleanup: if (config_input) fclose(config_input); free(config_buffer); - free(device); + free_wgdevice(device); return ret; } |