[Commits] [SCM] clawsker branch, master, updated. 1.3.2-9-g69775d2

mones at claws-mail.org mones at claws-mail.org
Sun Feb 7 18:42:33 UTC 2021


The branch, master has been updated
       via  69775d272a8dcb9cbc7945fc288e939685651598 (commit)
      from  8b385099a7dbccf4cedaaf7fe6d5e5658659705e (commit)

Summary of changes:
 clawsker | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)


- Log -----------------------------------------------------------------
commit 69775d272a8dcb9cbc7945fc288e939685651598
Author: Ricardo Mones <ricardo at mones.org>
Date:   Sun Feb 7 19:33:04 2021 +0100

    Fix detection of running of recent Claws Mail
    
    Starting in version 3.17.8-15-ge56346845 the socket path is built using
    g_get_user_runtime_dir¹ insead of g_get_tmp_dir².
    
    This change rendered the  current detection scheme invalid, though it's
    still available as fallback to detect older Claws Mail versions.
    
    This fix hopefully emulates that function by reading the same
    environment variables.
    
    ¹ https://developer.gnome.org/glib/stable/glib-Miscellaneous-Utility-Functions.html#g-get-user-runtime-dir
    ² https://developer.gnome.org/glib/stable/glib-Miscellaneous-Utility-Functions.html#g-get-tmp-dir

diff --git a/clawsker b/clawsker
index d8ae30a..d68c389 100755
--- a/clawsker
+++ b/clawsker
@@ -461,16 +461,27 @@ sub claws_is_running {
     return FALSE;
 }
 
-sub check_claws_not_running {
-    return TRUE if $READONLY;
-    my $tmpdir = File::Spec->tmpdir ();
-    my $lockdir = catfile ($tmpdir, "claws-mail-$<");
+sub has_claws_socket {
+    my $lockdir = shift;
     -d $lockdir and do {
         $_ = $CONFIGDIR;
         s/\/$//;
         my $socket = catfile ($lockdir, md5_hex ($_));
-        -S $socket and return claws_is_running ();
+        -S $socket and return TRUE;
+    };
+    return FALSE;
+}
+
+sub check_claws_not_running {
+    return TRUE if $READONLY;
+    my $rundir = $ENV{XDG_RUNTIME_DIR} // $ENV{XDG_CACHE_HOME};
+    defined $rundir and do {
+        my $lockdir = catfile ($rundir, "claws-mail");
+        return claws_is_running () if has_claws_socket ($lockdir);
     };
+    my $tmpdir = File::Spec->tmpdir ();
+    my $lockdir = catfile ($tmpdir, "claws-mail-$<");
+    return claws_is_running () if has_claws_socket ($lockdir);
     return TRUE;
 }
 

-----------------------------------------------------------------------


hooks/post-receive
-- 
Hidden preferences editor for Claws Mail


More information about the Commits mailing list