gods

a simple blocklist for ssh
Log | Files | Refs | README | LICENSE

commit ab58abffb9808ad1b65cc09e9656699e6fcececc
parent 91e719d56483a03d30d112276dc26e2d327b4a74
Author: Naveen Narayanan <zerous@nocebo.space>
Date:   Fri,  1 Oct 2021 02:11:28 +0200

Fix EOF case

Move EOF logic to beginning of the loop as it never gets called if
parse fails otherwise.

Diffstat:
Mmain.c | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/main.c b/main.c @@ -59,9 +59,14 @@ main(int argc, char **argv) if (!fp) err(1, "fopen failed: %s", sshlog); + c = 0; for ( ; ; ) { + if (c == EOF) + break; + line = buf; memset(buf, 0, BUFSZ); + while ((c = fgetc(fp)) != EOF) { if (c == '\n') { *line = '\0'; @@ -102,9 +107,6 @@ main(int argc, char **argv) } unban(NULL, &head); - - if (c == EOF) - break; } return 0; }