diff --git a/locale/tr/LC_MESSAGES/libmp.po b/locale/tr/LC_MESSAGES/libmp.po index 4acaa5f..d395b62 100644 --- a/locale/tr/LC_MESSAGES/libmp.po +++ b/locale/tr/LC_MESSAGES/libmp.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-16 05:23+0300\n" +"POT-Creation-Date: 2024-08-16 06:47+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/src/ctx/ctx.c b/src/ctx/ctx.c index c07fefb..88ac633 100644 --- a/src/ctx/ctx.c +++ b/src/ctx/ctx.c @@ -3,12 +3,13 @@ #include "../../include/ctx.h" #include +#include #include #include #include #include #include -#include +#include bool __lm_ctx_init_checkdir(char *path){ if(!mkdir_ifnot(path, 0755)){ @@ -100,6 +101,8 @@ end: void lm_ctx_free(lm_ctx_t *ctx) { lm_ctx_pool_clear(ctx); + lm_ctx_temp_clear(ctx); + free(ctx->data); free(ctx->root); free(ctx->temp); diff --git a/src/ctx/install.c b/src/ctx/install.c index 897966b..9d665a4 100644 --- a/src/ctx/install.c +++ b/src/ctx/install.c @@ -229,10 +229,8 @@ bool lm_ctx_install(lm_ctx_t *ctx, lm_pkg_t *pkg, bool run_install, lm_ctx_insta return false; } - if(!mkdir_ifnot(ctx->temp, 0755)){ - lm_error_set(LM_ERR_CtxTempFailMkdir); - return false; - } + if(!lm_ctx_temp_clear(ctx)) + return false; // error set by function if(!lm_ctx_database_init(ctx)) return false; // error set by function diff --git a/src/ctx/temp.c b/src/ctx/temp.c index c52f171..6ccf7a1 100644 --- a/src/ctx/temp.c +++ b/src/ctx/temp.c @@ -42,4 +42,3 @@ bool lm_ctx_temp_clear(lm_ctx_t *ctx) { return true; } - diff --git a/src/database/database.c b/src/database/database.c index 0662e83..6366052 100644 --- a/src/database/database.c +++ b/src/database/database.c @@ -38,7 +38,7 @@ lm_database_t *lm_database_new(char *path){ char *err = NULL; bzero(db, sizeof(lm_database_t)); - if(exists(path, NULL) && (is_file(path) || !can_read(path) || !can_write(path))){ + if(exists(path, NULL) && (is_file(path) || !can_read(path))){ lm_error_set(LM_ERR_DbCantAccess); return NULL; } @@ -58,7 +58,7 @@ lm_database_t *lm_database_new(char *path){ return NULL; } - if(sqlite3_exec(db->sql, queries[QUERY_CREATE_TABLE], NULL, 0, &err) != SQLITE_OK){ + if(can_write(path) && sqlite3_exec(db->sql, queries[QUERY_CREATE_TABLE], NULL, 0, &err) != SQLITE_OK){ pdebug(__func__, "(%s) failed to create packages table: %s", packagesdb, err); lm_error_set(LM_ERR_DbSqlCreateFail); sqlite3_free(err);