fix: do not check write permissions for ctx dirs
This commit is contained in:
@ -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") },
|
||||
|
Reference in New Issue
Block a user