mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
Verify if a certain resource exists before do any other sanity check
This commit is contained in:
parent
6143eb99e3
commit
c49688fd7d
@ -147,6 +147,9 @@ bool createDir(std::string dir, int mode, std::string *error) {
|
|||||||
bool isFile(std::string f) {
|
bool isFile(std::string f) {
|
||||||
struct stat fileInfo;
|
struct stat fileInfo;
|
||||||
FILE *fp = fopen(f.c_str(), "r");
|
FILE *fp = fopen(f.c_str(), "r");
|
||||||
|
if (fp == NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
fstat(fileno(fp), &fileInfo);
|
fstat(fileno(fp), &fileInfo);
|
||||||
if (!S_ISREG(fileInfo.st_mode)) {
|
if (!S_ISREG(fileInfo.st_mode)) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user