commit 9f5404990ddc886d00624faf41d805f81857e1e3
parent 3d03b522e04f94e384aa9b7d87117a20b7ae0268
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 4 Aug 2020 23:12:03 +0200
fixup strdup() from the last patch
Diffstat:
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/svkbd.c b/svkbd.c
@@ -886,7 +886,6 @@ main(int argc, char *argv[]) {
signal(SIGTERM, sigterm);
-
/* parse environment variables */
if (OVERLAYS <= 1) {
enableoverlays = 0;
@@ -894,9 +893,9 @@ main(int argc, char *argv[]) {
const char* enableoverlays_env = getenv("SVKBD_ENABLEOVERLAYS");
if (enableoverlays_env != NULL) enableoverlays = atoi(enableoverlays_env);
}
- const char* layers_env = getenv("SVKBD_LAYERS");
+ char *layers_env = getenv("SVKBD_LAYERS");
if (layers_env != NULL) {
- if (!strdup(layer_names_list, layers_env)) {
+ if (!(layer_names_list = strdup(layers_env))) {
die("memory allocation error\n");
}
}
@@ -942,7 +941,7 @@ main(int argc, char *argv[]) {
if(i >= argc - 1)
continue;
free(layer_names_list);
- if (!strdup(layer_names_list, argv[++i])) {
+ if (!(layer_names_list = strdup(argv[++i]))) {
die("memory allocation error\n");
}
} else if(!strcmp(argv[i], "-s")) {