From 7d87c7c81732c5886a79d2cefb9e30842f9ac446 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Mon, 3 May 2021 09:09:43 +0200 Subject: [PATCH] get_shadow_line: Handle config file read error --- get_shadow_line.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/get_shadow_line.c b/get_shadow_line.c index 84ab79d..2c289ab 100644 --- a/get_shadow_line.c +++ b/get_shadow_line.c @@ -22,8 +22,12 @@ static int read_config(struct sockaddr_in *addr) { int port = -1; while (1) { int status = getline(&line, &n, f); - if (status == -1) - break; + if (status == -1) { + if (feof(f)) + break; + perror(conf_filename); + return -1; + } char *comment = strchr(line, '#'); if (comment) { *comment = 0;