gods

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

commit 79938c65dc7580c4653fa7adce0b0db6aaf1fe3f
parent f5850f6611e4669aab969ec02e6ade80e7edb7d4
Author: Naveen Narayanan <zerous@nocebo.space>
Date:   Thu, 30 Sep 2021 19:47:02 +0200

err() out in case of unrecoverable errors

Diffstat:
Mmain.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/main.c b/main.c @@ -1,3 +1,4 @@ +#include <err.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> @@ -55,7 +56,7 @@ main(int argc, char **argv) fp = fopen("./authlog", "r"); if (!fp) - fprintf(stderr, "fopen failed: %s\n", strerror(errno)); + err(1, "fopen failed: %s", sshlog); for (;;) { line = buf; @@ -83,6 +84,8 @@ main(int argc, char **argv) if (!found) { a = malloc(sizeof(struct attacker)); + if (!a) + err(1, "malloc failed"); init(a); SLIST_INSERT_HEAD(&head, a, attackers); }