Skip to content

Commit 872e5a5

Browse files
author
Robin Müller
committed
Exit the program if no touch device path is configured
1 parent 700c1b0 commit 872e5a5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/configuraion.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <iniparser.h>
2828

2929
#include "configuraion.h"
30+
#include "common.h"
3031

3132
static void clean_config(configuration_t *config) {
3233
int32_t i, j, k;
@@ -45,12 +46,12 @@ configuration_t read_config(const char *filename) {
4546
dictionary *ini = iniparser_load(filename);
4647
char *touch_device_path = iniparser_getstring(ini, "general:touchdevice", NULL);
4748
if (touch_device_path) {
48-
result.touch_device_path = malloc(strlen(touch_device_path) + 1);
49-
if (result.touch_device_path) {
49+
if (result.touch_device_path = malloc(strlen(touch_device_path) + 1)) {
5050
strcpy(result.touch_device_path, touch_device_path);
5151
}
5252
} else {
53-
result.touch_device_path = NULL;
53+
errno = EINVAL;
54+
die("error: no touch device defined");
5455
}
5556
result.vert_scroll = iniparser_getboolean(ini, "scroll:vertical", false);
5657
result.horz_scroll = iniparser_getboolean(ini, "scroll:horizontal", false);

0 commit comments

Comments
 (0)