From 515477b5d597b807b27d2f95950b937ab8684c00 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 11 Feb 2022 17:43:58 +0100 Subject: Add read local manga to automedia seen --- src/Storage.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/Storage.cpp') 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); -- cgit v1.2.3