diff --git a/lib/util.c b/lib/util.c index 7526da5..9e1f4df 100644 --- a/lib/util.c +++ b/lib/util.c @@ -136,7 +136,7 @@ void write_log(int type, const char *fmt, ...) va_list args; va_start(args, fmt); 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 log file doesn't exist, most likely data dir won't exist too */ 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); fprintf(log, details); vfprintf(log, fmt, args); + fclose(log); } - fclose(log); va_end(args); } diff --git a/src/client/db.c b/src/client/db.c index f2ee7a6..26ee81d 100644 --- a/src/client/db.c +++ b/src/client/db.c @@ -32,7 +32,7 @@ int sqlite_init() char *err_msg = 0; 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 log file doesn't exist, most likely data dir won't exist too */ create_data_dir();