Introduction
Introduction Statistics Contact Development Disclaimer Help
adding some minor error catching - svkbd - simple virtual keyboard
git clone git://git.suckless.org/svkbd
Log
Files
Refs
README
LICENSE
---
commit 12fe4c89234fcd4172fceead572b1950815228af
parent 4dab556580d2249e3f1597219b9c65bf8660f5e8
Author: Maarten van Gompel <[email protected]>
Date: Sun, 2 Aug 2020 15:46:17 +0200
adding some minor error catching
Diffstat:
M svkbd.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/svkbd.c b/svkbd.c
@@ -886,6 +886,7 @@ main(int argc, char *argv[]) {
const char* layers_env = getenv("SVKBD_LAYERS");
if (layers_env != NULL) {
layer_names_list = malloc(128);
+ if (!layer_names_list) die("memory allocation error\n");
strcpy(layer_names_list, layers_env);
}
const char* heightfactor_s = getenv("SVKBD_HEIGHTFACTOR");
@@ -929,7 +930,10 @@ main(int argc, char *argv[]) {
} else if(!strcmp(argv[i], "-l")) {
if(i >= argc - 1)
continue;
- if (layer_names_list == NULL) layer_names_list = mallo…
+ if (layer_names_list == NULL) {
+ layer_names_list = malloc(128);
+ if (!layer_names_list) die("memory allocation …
+ }
strcpy(layer_names_list, argv[++i]);
} else if(!strcmp(argv[i], "-s")) {
if(i >= argc - 1)
@@ -945,6 +949,8 @@ main(int argc, char *argv[]) {
}
}
+ if (heightfactor <= 0) die("height factor must be a positive integer\n…
+
init_layers(layer_names_list, initial_layer_name);
if(!setlocale(LC_CTYPE, "") || !XSupportsLocale())
@@ -955,6 +961,6 @@ main(int argc, char *argv[]) {
run();
cleanup();
XCloseDisplay(dpy);
- if (layer_names_list != NULL) free(layer_names_list);
+ free(layer_names_list);
return 0;
}
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.