From dce3e15c94d79aae009dfbc17d2d83cd254ea98c Mon Sep 17 00:00:00 2001 From: caRJ33 Date: Tue, 25 Dec 2018 17:19:48 +0100 Subject: Error handling for missing kernel taint file Add missing new line to no taint message --- main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'main.c') diff --git a/main.c b/main.c index 693749b..b9010a0 100644 --- a/main.c +++ b/main.c @@ -57,7 +57,7 @@ void check_flags(int taintval) { check_taint_flag(taintval, TAINT_AUX, "AUX", "Auxiliary taint, defined and used by distros"); check_taint_flag(taintval, TAINT_STRUCT_RANDOM, "STRUCT_RANDOM", "The kernel was built with the struct randomization plugin"); } else { - printf("Kernel is not tainted :)"); + printf("Kernel is not tainted :)\n"); } } @@ -68,6 +68,10 @@ void check_proc() { // Read /proc/sys/kernel/tainted fh = fopen("/proc/sys/kernel/tainted", "r"); + if (fh == NULL) { + printf("No kernel taint file found :(\n"); + exit(EXIT_FAILURE); + } size = fread(&buf, 1, sizeof(buf), fh); fclose(fh); -- cgit v1.2.3