add failure handling

This commit is contained in:
Olaf Rempel 2017-12-31 13:54:45 +01:00
parent 5ddc96811a
commit 43118a9844

11
qnapd.c
View File

@ -139,6 +139,7 @@ int main(int argc, char *argv[])
while (1) {
struct lcddev *lcd = NULL;
struct picdev *pic = NULL;
int abort = 0;
do {
const char *devicename = config_get_string("global", "lcddevice", NULL);
@ -149,10 +150,12 @@ int main(int argc, char *argv[])
lcd = lcd_open(devicename, lcdtimeout);
if (lcd == NULL) {
abort = 1;
break;
}
if (lcdpage_init(lcd) < 0) {
abort = 1;
break;
}
}
@ -161,12 +164,15 @@ int main(int argc, char *argv[])
if (devicename != NULL) {
pic = pic_open(devicename, lcd);
if (pic == NULL) {
abort = 1;
break;
}
}
if (diskwatch_init(lcd) < 0)
if (diskwatch_init(lcd) < 0) {
abort = 1;
break;
}
/* exited on restart / SIGUSR1 */
event_loop(check_restart, NULL, NULL);
@ -185,6 +191,9 @@ int main(int argc, char *argv[])
config_free();
if (abort)
break;
if (config_parse(config) < 0)
break;