Updated file validation

This commit is contained in:
Uwe Seimet 2021-09-17 19:54:42 +02:00
parent 7a1a2ec328
commit 9663144c45

View File

@ -717,7 +717,8 @@ string SetReservedIds(const string& ids)
bool IsValidFilename(const string& filename) bool IsValidFilename(const string& filename)
{ {
return filename != "." && filename != ".."; struct stat st;
return !stat(filename.c_str(), &st) && S_ISREG(st.st_mode);
} }
bool CreateImage(int fd, const PbCommand& command) bool CreateImage(int fd, const PbCommand& command)