fix: do not check write permissions for ctx dirs

This commit is contained in:
ngn
2024-08-16 04:22:04 +03:00
parent a641ef87ed
commit 2aa147b351
4 changed files with 12 additions and 6 deletions
include
locale/tr/LC_MESSAGES
src

@ -21,8 +21,8 @@ bool __lm_ctx_init_checkdir(char *path){
return false;
}
if(!can_write(path)){
lm_error_set(LM_ERR_NoWrite);
if(!can_read(path)){
lm_error_set(LM_ERR_NoRead);
return false;
}
@ -63,6 +63,12 @@ bool lm_ctx_new(lm_ctx_t *ctx, char *root_dir, char *temp_dir, char *data_dir) {
goto end;
}
if(root_dir != NULL && !can_write(root_dir)){
pdebug(__func__, "check failed for specified root directory: %s", lm_strerror());
lm_error_set(LM_ERR_CtxRootFail, root_dir, "directory is not writeable");
goto end;
}
if(root_dir != NULL)
ctx->root = realpath(root_dir, NULL);

@ -168,7 +168,7 @@ void lm_error_set(lm_error_t code, ...) {
{.code = LM_ERR_DbChangesNotExists, .desc = _("package changes file not found in the database") },
{.code = LM_ERR_DbChangesChmodFail, .desc = _("failed to change mod of the changes file") },
{.code = LM_ERR_InstallDirFail, .desc = _("failed to create install script save directory") },
{.code = LM_ERR_NoWrite, .desc = _("directory does not have write permissions") },
{.code = LM_ERR_NoRead, .desc = _("directory does not have read permissions") },
{.code = LM_ERR_NotDir, .desc = _("specified path is not a directory") },
{.code = LM_ERR_FailMkdir, .desc = _("failed to create the specified directory") },
{.code = LM_ERR_PoolListBadDir, .desc = _("specified list extraction directory is not accessible") },