This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository efm2.
View the commit online.
commit 90e9e4c4495d4df19f1dff92421180d932dee469
Author: Carsten Haitzler (Rasterman) <[email protected]>
AuthorDate: Wed May 13 13:27:52 2026 +0100
open - remove extra stats for is exec by re-using stat info
---
src/backends/default/open.c | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/src/backends/default/open.c b/src/backends/default/open.c
index b304b30..2c33388 100644
--- a/src/backends/default/open.c
+++ b/src/backends/default/open.c
@@ -697,8 +697,24 @@ _cmd_desktop_x_field_icon_resolve_append(Eina_Strbuf *strbuf,
free(icf);
}
+static Eina_Bool
+_can_exec_stat(struct stat *st)
+{
+ uid_t uid = geteuid();
+
+ if (uid == 0) // root
+ {
+ if (st->st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) return EINA_TRUE;
+ return EINA_FALSE;
+ }
+ if ((st->st_uid == uid) && (st->st_mode & S_IXUSR)) return EINA_TRUE;
+ else if ((st->st_gid == getegid()) && (st->st_mode & S_IXGRP)) return EINA_TRUE;
+ else if (st->st_mode & S_IXOTH) return EINA_TRUE;
+ return EINA_FALSE;
+}
+
const char *
-_mime_get(const char *file)
+_mime_get(const char *file, struct stat *st)
{
const char *fname;
@@ -711,7 +727,7 @@ _mime_get(const char *file)
{ // if it has no extn and is executable... let's say it is an exe.
if (fname[0] // has at least 1 char in filename
&& !(strchr(fname + 1, '.')) // no extension
- && ecore_file_can_exec(file)) // is executable
+ && _can_exec_stat(st)) // is executable
return "application/x-executable";
}
// XXX: this is expensive - has to open files and inspect them
@@ -937,7 +953,7 @@ _file_add_mod_info(Eina_Strbuf *strbuf, const char *path, Eina_Bool delay)
}
}
else cmd_strbuf_append(strbuf, "link-type", "file");
- mime = _mime_get(dst);
+ mime = _mime_get(dst, &stdst);
if (mime)
{
cmd_strbuf_append(strbuf, "mime", mime);
@@ -1004,7 +1020,7 @@ _file_add_mod_info(Eina_Strbuf *strbuf, const char *path, Eina_Bool delay)
else // stat of original failed - what do we do?
{
cmd_strbuf_append(strbuf, "broken-link", "true");
- mime = _mime_get(path);
+ mime = _mime_get(path, &st);
if (mime)
{
cmd_strbuf_append(strbuf, "mime", mime);
@@ -1053,7 +1069,7 @@ _file_add_mod_info(Eina_Strbuf *strbuf, const char *path, Eina_Bool delay)
}
}
else cmd_strbuf_append(strbuf, "type", "file");
- mime = _mime_get(path);
+ mime = _mime_get(path, &st);
if (mime)
{
cmd_strbuf_append(strbuf, "mime", mime);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.