fixup strdup() from the last patch - svkbd - simple virtual keyboard
(HTM) git clone git://git.suckless.org/svkbd
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 9f5404990ddc886d00624faf41d805f81857e1e3
(DIR) parent 3d03b522e04f94e384aa9b7d87117a20b7ae0268
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 4 Aug 2020 23:12:03 +0200
fixup strdup() from the last patch
Diffstat:
M svkbd.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
---
(DIR) 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")) {