This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository entice.
View the commit online.
commit 833f296a2174274599b72219523cbca4122534f2
Author: Vincent Torri <vto...@outlook.fr>
AuthorDate: Tue Jun 17 09:55:56 2025 +0200
fix compilation on Linux
---
src/bin/entice_thumb.c | 13 +++++++--
src/bin/entice_thumb_common.c | 9 ++++--
src/bin/thumb_generator/entice_thumb_generator.c | 2 +-
src/bin/thumb_generator/entice_thumb_generator.h | 6 ++++
src/bin/thumb_generator/meson.build | 1 +
src/bin/thumb_generator/thumb_util_file.c | 37 ++++++++++++++++++++++++
6 files changed, 62 insertions(+), 6 deletions(-)
diff --git a/src/bin/entice_thumb.c b/src/bin/entice_thumb.c
index 185552d..3fd10c5 100644
--- a/src/bin/entice_thumb.c
+++ b/src/bin/entice_thumb.c
@@ -5,7 +5,9 @@
#include <config.h>
-#include <Elementary.h>
+#include <sys/stat.h>
+
+#include <Efreet.h>
/*============================================================================*
* Local *
@@ -74,8 +76,13 @@ entice_thumb_sha1(const char *file, unsigned char dst[20])
(unsigned long long)(last_write.QuadPart));
#else
# ifdef STAT_NSEC
-# define STAT_NSEC_MTIME(st) (unsigned long long)((st).st_mtimensec)
-# define STAT_NSEC_CTIME(st) (unsigned long long)((st).st_ctimensec)
+# ifdef st_mtime
+# define STAT_NSEC_MTIME(st) (unsigned long long)((st).st_mtim.tv_nsec)
+# define STAT_NSEC_CTIME(st) (unsigned long long)((st).st_ctim.tv_nsec)
+# else
+# define STAT_NSEC_MTIME(st) (unsigned long long)((st).st_mtimensec)
+# define STAT_NSEC_CTIME(st) (unsigned long long)((st).st_ctimensec)
+# endif
# else
# define STAT_NSEC_MTIME(st) (unsigned long long)(0)
# define STAT_NSEC_CTIME(st) (unsigned long long)(0)
diff --git a/src/bin/entice_thumb_common.c b/src/bin/entice_thumb_common.c
index 30404ab..df46bac 100644
--- a/src/bin/entice_thumb_common.c
+++ b/src/bin/entice_thumb_common.c
@@ -74,8 +74,13 @@ entice_thumb_sha1(const char *file, unsigned char dst[20])
(unsigned long long)(last_write.QuadPart));
#else
# ifdef STAT_NSEC
-# define STAT_NSEC_MTIME(st) (unsigned long long)((st).st_mtimensec)
-# define STAT_NSEC_CTIME(st) (unsigned long long)((st).st_ctimensec)
+# ifdef st_mtime
+# define STAT_NSEC_MTIME(st) (unsigned long long)((st).st_mtim.tv_nsec)
+# define STAT_NSEC_CTIME(st) (unsigned long long)((st).st_ctim.tv_nsec)
+# else
+# define STAT_NSEC_MTIME(st) (unsigned long long)((st).st_mtimensec)
+# define STAT_NSEC_CTIME(st) (unsigned long long)((st).st_ctimensec)
+# endif
# else
# define STAT_NSEC_MTIME(st) (unsigned long long)(0)
# define STAT_NSEC_CTIME(st) (unsigned long long)(0)
diff --git a/src/bin/thumb_generator/entice_thumb_generator.c b/src/bin/thumb_generator/entice_thumb_generator.c
index 283e00a..5afdbfe 100644
--- a/src/bin/thumb_generator/entice_thumb_generator.c
+++ b/src/bin/thumb_generator/entice_thumb_generator.c
@@ -66,7 +66,7 @@ _entice_thumb_output_close(Eet_File *ef, const char *thumb)
if (!eina_strbuf_append(buf, ".tmp")) goto err_;
// fix permissions on file to match parent dir
#ifndef _WIN32
- util_file_mode_parent_copy(buf, EINA_FALSE);
+ util_file_mode_parent_copy(eina_strbuf_string_get(buf), EINA_FALSE);
#endif
ecore_file_mv(eina_strbuf_string_get(buf), thumb);
err_:
diff --git a/src/bin/thumb_generator/entice_thumb_generator.h b/src/bin/thumb_generator/entice_thumb_generator.h
index fdf84e2..c5131c6 100644
--- a/src/bin/thumb_generator/entice_thumb_generator.h
+++ b/src/bin/thumb_generator/entice_thumb_generator.h
@@ -52,6 +52,12 @@ int thumb_video(Eet_File *ef,
const char *mime EINA_UNUSED,
const char *thumb EINA_UNUSED);
+#ifndef _WIN32
+
+void thumb_file_mode_parent_copy(const char *file, Eina_Bool is_dir);
+
+#endif
+
void thumb_image_write(Eet_File *ef,
const char *key,
Evas_Object *img,
diff --git a/src/bin/thumb_generator/meson.build b/src/bin/thumb_generator/meson.build
index 8320a62..a29e261 100644
--- a/src/bin/thumb_generator/meson.build
+++ b/src/bin/thumb_generator/meson.build
@@ -6,6 +6,7 @@
entice_thumb_generator_src = files([
'../entice_thumb_common.c',
'entice_thumb_generator.c',
+ 'thumb_util_file.c',
'thumb_util_img.c',
'thumb_util_search.c',
'thumb_util_url.c',
diff --git a/src/bin/thumb_generator/thumb_util_file.c b/src/bin/thumb_generator/thumb_util_file.c
new file mode 100644
index 0000000..28632a3
--- /dev/null
+++ b/src/bin/thumb_generator/thumb_util_file.c
@@ -0,0 +1,37 @@
+/*
+ * SPDX-FileCopyrightText: Vincent Torri <vincent.to...@gmail.com>
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#ifndef _WIN32
+
+#include <Eina.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+void
+util_file_mode_parent_copy(const char *file, Eina_Bool is_dir)
+{
+ struct stat st;
+ char *s, *dir_parent = strdup(file);
+
+ if (!dir_parent) return;
+ s = strrchr(dir_parent, '/');
+ if (!s) goto err;
+ s[1] = '\0'; // get parent dir by truncating after /
+ if (lstat(dir_parent, &st) == 0)
+ { // copy the parent dir mode to the child file given
+ chown(file, st.st_uid, st.st_gid);
+ // if it's not a dir - filter out execute mode
+ if (!is_dir)
+ st.st_mode &= S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
+ chmod(file, st.st_mode);
+ }
+err:
+ free(dir_parent);
+}
+
+#endif
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.