aboutsummaryrefslogtreecommitdiff
path: root/src/Storage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Storage.cpp')
-rw-r--r--src/Storage.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Storage.cpp b/src/Storage.cpp
index a0f20e4..f4732b8 100644
--- a/src/Storage.cpp
+++ b/src/Storage.cpp
@@ -163,6 +163,13 @@ namespace QuickMedia {
FILE *file = fopen_eintr(path.data.c_str(), "rb");
if(!file)
return -errno;
+
+ int fd = fileno(file);
+ struct stat s;
+ if(fstat(fd, &s) == -1 || !S_ISREG(s.st_mode)) {
+ fclose(file);
+ return -1;
+ }
fseek_eintr(file, 0, SEEK_END);
long file_size = ftell(file);