Fix file paths within CLIENT_DATA_DIR

This commit is contained in:
Night Kaly 2024-09-20 17:54:32 +01:00
parent a927c5c36c
commit 87b3f984c1
Signed by: night0721
GPG key ID: 957D67B8DB7A119B
2 changed files with 3 additions and 3 deletions

View file

@ -136,7 +136,7 @@ void write_log(int type, const char *fmt, ...)
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
char *client_log = memalloc(PATH_MAX); char *client_log = memalloc(PATH_MAX);
snprintf(client_log, PATH_MAX, "%s/%s", CLIENT_DATA_DIR, "zen.log"); snprintf(client_log, PATH_MAX, "%s/%s", CLIENT_DATA_DIR, "/zen.log");
if (access(client_log, W_OK) != 0) { if (access(client_log, W_OK) != 0) {
/* If log file doesn't exist, most likely data dir won't exist too */ /* If log file doesn't exist, most likely data dir won't exist too */
create_data_dir(); create_data_dir();
@ -155,8 +155,8 @@ void write_log(int type, const char *fmt, ...)
snprintf(details, 2 + type_len + 22, "%s%s", logtype, time); snprintf(details, 2 + type_len + 22, "%s%s", logtype, time);
fprintf(log, details); fprintf(log, details);
vfprintf(log, fmt, args); vfprintf(log, fmt, args);
fclose(log);
} }
fclose(log);
va_end(args); va_end(args);
} }

View file

@ -32,7 +32,7 @@ int sqlite_init()
char *err_msg = 0; char *err_msg = 0;
char *zen_db = memalloc(PATH_MAX); char *zen_db = memalloc(PATH_MAX);
snprintf(zen_db, PATH_MAX, "%s/%s", CLIENT_DATA_DIR, "zen.db"); snprintf(zen_db, PATH_MAX, "%s/%s", CLIENT_DATA_DIR, "/zen.db");
if (access(zen_db, W_OK) != 0) { if (access(zen_db, W_OK) != 0) {
/* If log file doesn't exist, most likely data dir won't exist too */ /* If log file doesn't exist, most likely data dir won't exist too */
create_data_dir(); create_data_dir();