fix: do not check write permissions for ctx dirs
This commit is contained in:
parent
a641ef87ed
commit
2aa147b351
@ -140,7 +140,7 @@ typedef enum lm_error {
|
|||||||
LM_ERR_InstallSaveFail = 138,
|
LM_ERR_InstallSaveFail = 138,
|
||||||
LM_ERR_FailMkdir = 139,
|
LM_ERR_FailMkdir = 139,
|
||||||
LM_ERR_NotDir = 140,
|
LM_ERR_NotDir = 140,
|
||||||
LM_ERR_NoWrite = 141,
|
LM_ERR_NoRead = 141,
|
||||||
LM_ERR_PoolListBadDir = 142,
|
LM_ERR_PoolListBadDir = 142,
|
||||||
LM_ERR_FileNotExist = 143,
|
LM_ERR_FileNotExist = 143,
|
||||||
LM_ERR_FileNotLink = 144,
|
LM_ERR_FileNotLink = 144,
|
||||||
|
@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2024-08-16 03:06+0300\n"
|
"POT-Creation-Date: 2024-08-16 04:21+0300\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@ -600,7 +600,7 @@ msgid "failed to create install script save directory"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/error.c:171
|
#: src/error.c:171
|
||||||
msgid "directory does not have write permissions"
|
msgid "directory does not have read permissions"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/error.c:172
|
#: src/error.c:172
|
||||||
|
@ -21,8 +21,8 @@ bool __lm_ctx_init_checkdir(char *path){
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!can_write(path)){
|
if(!can_read(path)){
|
||||||
lm_error_set(LM_ERR_NoWrite);
|
lm_error_set(LM_ERR_NoRead);
|
||||||
return false;
|
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;
|
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)
|
if(root_dir != NULL)
|
||||||
ctx->root = realpath(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_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_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_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_NotDir, .desc = _("specified path is not a directory") },
|
||||||
{.code = LM_ERR_FailMkdir, .desc = _("failed to create the specified directory") },
|
{.code = LM_ERR_FailMkdir, .desc = _("failed to create the specified directory") },
|
||||||
{.code = LM_ERR_PoolListBadDir, .desc = _("specified list extraction directory is not accessible") },
|
{.code = LM_ERR_PoolListBadDir, .desc = _("specified list extraction directory is not accessible") },
|
||||||
|
Loading…
Reference in New Issue
Block a user