summaryrefslogtreecommitdiff
path: root/src/lib/efreet
diff options
context:
space:
mode:
authorWonguk Jeong <wonguk.jeong@samsung.com>2014-04-17 19:34:33 +0200
committerCedric Bail <cedric.bail@free.fr>2014-04-17 19:34:38 +0200
commite32f033853f90a5ff00b03090b3cf08630b11e22 (patch)
treeaab925948ca19395930843e7a9e37fb112ed3f27 /src/lib/efreet
parentd9ea423b91c372e0a50ec90efeed53d14995be97 (diff)
efreet: check magic only for file which has size
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>
Diffstat (limited to 'src/lib/efreet')
-rw-r--r--src/lib/efreet/efreet_mime.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/efreet/efreet_mime.c b/src/lib/efreet/efreet_mime.c
index b21a75e1a5..23d86cfd3f 100644
--- a/src/lib/efreet/efreet_mime.c
+++ b/src/lib/efreet/efreet_mime.c
@@ -1244,6 +1244,14 @@ efreet_mime_magic_check_priority(const char *file,
1244 const char *last_mime = NULL; 1244 const char *last_mime = NULL;
1245 int c; 1245 int c;
1246 char v, buf[EFREET_MIME_MAGIC_BUFFER_SIZE]; 1246 char v, buf[EFREET_MIME_MAGIC_BUFFER_SIZE];
1247 struct stat s;
1248
1249#ifdef _WIN32
1250 if (stat(file, &s) || s.st_size == 0)
1251#else
1252 if (lstat(file, &s) || s.st_size == 0)
1253#endif
1254 return NULL;
1247 1255
1248 f = fopen(file, "rb"); 1256 f = fopen(file, "rb");
1249 if (!f) return NULL; 1257 if (!f) return NULL;