assert LY_CFG_SAVE

Throw an error instead of segfault when /etc/ly doesn't exist.
This commit is contained in:
noise 2018-04-05 13:28:38 -04:00 committed by GitHub
parent 5a01a6e38f
commit b8b6df849c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -1,6 +1,7 @@
#define _XOPEN_SOURCE
/* stdlib */
#include <assert.h>
#include <string.h>
#include <stdlib.h>
/* 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);