Skip to content

Commit

Permalink
get_shadow_line: Handle config file read error
Browse files Browse the repository at this point in the history
  • Loading branch information
donald committed May 3, 2021
1 parent b3df6b1 commit 7d87c7c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions get_shadow_line.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7d87c7c

Please sign in to comment.