works on download script

This commit is contained in:
Hugo LAMY
2022-08-17 20:41:22 +02:00
parent 875810c992
commit df24de46c7
5 changed files with 19 additions and 11 deletions

View File

@@ -181,7 +181,7 @@ void
http_body += HTML_BODY_BOTTOM;
}
size_t eval_file_read(const std::string &path)
size_t eval_file_access(const std::string &path, int mode)
{
if (::access(path.c_str(), F_OK) == -1)
{
@@ -189,7 +189,7 @@ size_t eval_file_read(const std::string &path)
return 404; // NOT_FOUND, file doesn't exist
}
if (::access(path.c_str(), R_OK) == -1)
if (::access(path.c_str(), mode) == -1)
{
std::perror("err access()");
return 403; // FORBIDDEN, file doesn't have access permission