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 aa1a6162c275472abde98201090ded128240dfd5
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
AuthorDate: Wed Jun 12 19:12:41 2024 +0100

    efm thumbs - dup permission of the dir they are in
---
 src/backends/default/thumb.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/backends/default/thumb.c b/src/backends/default/thumb.c
index 011cca1..e0aa90b 100644
--- a/src/backends/default/thumb.c
+++ b/src/backends/default/thumb.c
@@ -25,10 +25,24 @@ _thumb_output_open(const char *thumb)
 static void
 _thumb_output_close(Eet_File *ef, const char *thumb)
 { // close thumnb file and atomically rename tmp file on top of target
-  char buf[PATH_MAX];
+  char buf[PATH_MAX], *dir;
+  struct stat st;
 
   eet_close(ef);
   snprintf(buf, sizeof(buf), "%s.tmp", thumb);
+  // fix permissions on file to match parent dir
+  dir = ecore_file_dir_get(buf);
+  if (dir)
+    {
+      if (lstat(dir, &st) == 0)
+        {
+          chown(buf, st.st_uid, st.st_gid);
+          chmod(buf, st.st_mode
+                       & (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH
+                          | S_IWOTH));
+        }
+      free(dir);
+    }
   ecore_file_mv(buf, thumb);
 }
 
@@ -90,8 +104,8 @@ elm_main(int argc, char **argv)
   // write out the original file path so we could walk through all thumbs
   // and find which thumbs no longer have an original file left
   eet_write(ef, "orig/path", path, strlen(path), EET_COMPRESSION_LOW);
-  // write out our sha1 of the file stat info - quick and mostly right way
-  // to heck if the thumb is up to date with file
+  // write out our sha1 of the file stat info - quick and mostly right
+  // way to check if the thumb is up to date with file
   eet_write(ef, "orig/stat/sha1", statsha1, 20, EET_COMPRESSION_NONE);
   // done - finish file write and atomic rename
   _thumb_output_close(ef, thumb);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to