mirror of https://github.com/fairyglade/ly.git
assert LY_CFG_SAVE
Throw an error instead of segfault when /etc/ly doesn't exist.
This commit is contained in:
parent
5a01a6e38f
commit
b8b6df849c
|
@ -1,6 +1,7 @@
|
||||||
#define _XOPEN_SOURCE
|
#define _XOPEN_SOURCE
|
||||||
|
|
||||||
/* stdlib */
|
/* stdlib */
|
||||||
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
/* linux */
|
/* linux */
|
||||||
|
@ -105,6 +106,7 @@ int main(void)
|
||||||
/* saves the username and DE if enabled */
|
/* saves the username and DE if enabled */
|
||||||
if(LY_CFG_WRITE_SAVE)
|
if(LY_CFG_WRITE_SAVE)
|
||||||
{
|
{
|
||||||
|
assert(LY_CFG_SAVE);
|
||||||
FILE* file = fopen(LY_CFG_SAVE, "ab+");
|
FILE* file = fopen(LY_CFG_SAVE, "ab+");
|
||||||
file = fopen(LY_CFG_SAVE, "wb");
|
file = fopen(LY_CFG_SAVE, "wb");
|
||||||
fprintf(file, "%s\n%d", username, de_id);
|
fprintf(file, "%s\n%d", username, de_id);
|
||||||
|
|
Loading…
Reference in New Issue