From b8b6df849cc0a7062c78b57b059b8557ce72b104 Mon Sep 17 00:00:00 2001 From: noise <18649645+arwn@users.noreply.github.com> Date: Thu, 5 Apr 2018 13:28:38 -0400 Subject: [PATCH] assert LY_CFG_SAVE Throw an error instead of segfault when /etc/ly doesn't exist. --- src/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main.c b/src/main.c index 07cc231..678fd45 100644 --- a/src/main.c +++ b/src/main.c @@ -1,6 +1,7 @@ #define _XOPEN_SOURCE /* stdlib */ +#include #include #include /* linux */ @@ -105,6 +106,7 @@ int main(void) /* saves the username and DE if enabled */ if(LY_CFG_WRITE_SAVE) { + assert(LY_CFG_SAVE); FILE* file = fopen(LY_CFG_SAVE, "ab+"); file = fopen(LY_CFG_SAVE, "wb"); fprintf(file, "%s\n%d", username, de_id);