Summary:
Due to unnecessary magic checking, there was freezing in /proc in efm.
Proc file's st_size is zero, but, it's readable. therfore, it takes unnecessary time in magic checking. And, there is no need to check magic in case of 0 sized regular files as well.
Therefore, skip magic check in case of st_size is zero.
Fixes T1173
Test Plan: enlightenment -> file browser (efm) -> get int /proc --> check whether efm freezes or not
Reviewers: raster, cedric, zmike
CC: seoz, cedric
Maniphest Tasks: T1173
Differential Revision: https://phab.enlightenment.org/D764
Signed-off-by: Cedric Bail <cedric.bail@free.fr>
const char *last_mime = NULL;
int c;
char v, buf[EFREET_MIME_MAGIC_BUFFER_SIZE];
+ struct stat s;
+
+#ifdef _WIN32
+ if (stat(file, &s) || s.st_size == 0)
+#else
+ if (lstat(file, &s) || s.st_size == 0)
+#endif
+ return NULL;
f = fopen(file, "rb");
if (!f) return NULL;