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 71551dd179b1184ca253361da270180ffe69f14f
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
AuthorDate: Wed Jun 12 09:46:58 2024 +0100

    fix meta write check for share dirs and dont use .efm/.tmp dir
    
    use .efm/file.tmp filenames now...
    
    mind you 8.3 ye olde fat may not like this...
---
 src/backends/default/meta.c  |  3 ++-
 src/backends/default/mv.c    | 19 ++++++++-----------
 src/backends/default/thumb.c |  1 -
 3 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/src/backends/default/meta.c b/src/backends/default/meta.c
index 76233fc..a5fd2f5 100644
--- a/src/backends/default/meta.c
+++ b/src/backends/default/meta.c
@@ -415,7 +415,8 @@ meta_path_can_write(const char *path)
   // policy - we only consider dirs owned by the user writeable. want to
   // avoid e.g. root browsing then modifying dirs ownee by a user or dirs
   // that might have group write access being written to by multiple users
-  if ((st.st_uid == uid) && (st.st_mode & S_IWUSR))
+  if (((st.st_uid == uid) && (st.st_mode & S_IWUSR)) ||
+      (access(dir, W_OK) == 0))
     {
       snprintf(buf, sizeof(buf), "%s/.efm", dir);
       res = mkdir(buf, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH
diff --git a/src/backends/default/mv.c b/src/backends/default/mv.c
index 16ded30..6ce39b0 100644
--- a/src/backends/default/mv.c
+++ b/src/backends/default/mv.c
@@ -145,14 +145,6 @@ main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
     eina_strbuf_append(buf, "/.efm");
     prev_umask = umask(0);
     ret        = mkdir(eina_strbuf_string_get(buf), st.st_mode);
-    if ((ret != 0) && (errno != EEXIST))
-      {
-        status_error(fs->src, eina_strbuf_string_get(buf),
-                     "Cannot create directory");
-        break;
-      }
-    eina_strbuf_append(buf, "/.tmp");
-    ret = mkdir(eina_strbuf_string_get(buf), st.st_mode);
     if ((ret != 0) && (errno != EEXIST))
       {
         status_error(fs->src, eina_strbuf_string_get(buf),
@@ -163,8 +155,9 @@ main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
 
     eina_strbuf_reset(buf);
     eina_strbuf_append(buf, fs->dst);
-    eina_strbuf_append(buf, "/.efm/.tmp/");
+    eina_strbuf_append(buf, "/.efm/");
     eina_strbuf_append(buf, fname);
+    eina_strbuf_append(buf, ".tmp");
     // mv the file ...
     if (fs_mv(fs->src, eina_strbuf_string_get(buf), EINA_TRUE))
       { // it worked so deal with meta/thumbs
@@ -203,6 +196,8 @@ main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
         else src_meta = meta_path_user_find(fs->src, "thumb.efm");
         if (dst_can_write) dst_meta = meta_path_find(dstfile, "thumb.efm");
         else dst_meta = meta_path_user_find(dstfile, "thumb.efm");
+        fprintf(stderr, "MV: %i[%s] -> %i[%s]\n", src_can_write, src_meta,
+                dst_can_write, dst_meta);
         if ((src_meta) && (dst_meta) && (meta_path_prepare(dstfile)))
           {
             status_count(1, src_meta);
@@ -210,8 +205,9 @@ main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
             // fix up the oprig stat info to match so thub is valid
             eina_strbuf_reset(buf);
             eina_strbuf_append(buf, fs->dst);
-            eina_strbuf_append(buf, "/.efm/.tmp/");
+            eina_strbuf_append(buf, "/.efm/");
             eina_strbuf_append(buf, fname);
+            eina_strbuf_append(buf, ".tmp");
             // get stat info of new mv'd file
             if (stat(eina_strbuf_string_get(buf), &st) == 0)
               {
@@ -240,8 +236,9 @@ main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
         // are ok/valid
         eina_strbuf_reset(buf);
         eina_strbuf_append(buf, fs->dst);
-        eina_strbuf_append(buf, "/.efm/.tmp/");
+        eina_strbuf_append(buf, "/.efm/");
         eina_strbuf_append(buf, fname);
+        eina_strbuf_append(buf, ".tmp");
         eina_strbuf_reset(buf2);
         eina_strbuf_append(buf2, fs->dst);
         eina_strbuf_append(buf2, "/");
diff --git a/src/backends/default/thumb.c b/src/backends/default/thumb.c
index 01310e1..011cca1 100644
--- a/src/backends/default/thumb.c
+++ b/src/backends/default/thumb.c
@@ -1,5 +1,4 @@
 #include "thumb.h"
-#include "meta.h"
 
 Evas_Object *win    = NULL;
 Evas_Object *subwin = NULL;

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

Reply via email to