[Commits] [SCM] clawsker branch, master, updated. 1.1.1-7-g075fc20

mones at claws-mail.org mones at claws-mail.org
Thu Jul 26 22:25:23 CEST 2018


The branch, master has been updated
       via  075fc20012469195b3029e3bec94cceabdae5cef (commit)
      from  5fac794ae9741ba63ef668d63644ef3beeefa6db (commit)

Summary of changes:
 clawsker |   19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)


- Log -----------------------------------------------------------------
commit 075fc20012469195b3029e3bec94cceabdae5cef
Author: Ricardo Mones <ricardo at mones.org>
Date:   Thu Jul 26 22:23:27 2018 +0200

    Check for failed backups
    
    Create also a backup of menurc when saving

diff --git a/clawsker b/clawsker
index 97cefa2..8f6fdf8 100755
--- a/clawsker
+++ b/clawsker
@@ -2540,6 +2540,18 @@ sub save_resource {
     close (RCF);
 }
 
+sub backup_resource {
+    my $rc = shift;
+    my $rcbak = "$rc.backup";
+    do {
+        my $emsg = _("Unable to create backup file '{name}'\n", name => $rcbak);
+        log_message ($emsg);
+        error_dialog ($emsg);
+        return FALSE;
+    } unless rename ($rc, $rcbak);
+    return TRUE;
+}
+
 # specific loaders
 sub load_menurc {
     my $rc = shift;
@@ -2643,8 +2655,7 @@ sub save_rc_preferences {
     log_message ("Saving preferences to $rc\n");
     return FALSE unless check_rc_file ($rc);
     return FALSE unless check_claws_not_running ();
-    my $rcbak = "$rc.backup";
-    rename ($rc, $rcbak);
+    return FALSE unless backup_resource ($rc);
     foreach (keys %PREFS) {
         if (defined $HPVALUE{$_}) {
             $CONFIGDATA->{'Common'}{$_} = $HPVALUE{$_}[VALUE];
@@ -2666,8 +2677,7 @@ sub save_ac_preferences {
     log_message ("Saving account preferences to $rc\n");
     return FALSE unless check_rc_file ($rc);
     return FALSE unless check_claws_not_running ();
-    my $rcbak = "$rc.backup";
-    rename ($rc, $rcbak);
+    return FALSE unless backup_resource ($rc);
     foreach my $asect (keys %$ACCOUNTDATA) {
         if ($asect =~ /^Account: (\d+)$/) {
             foreach (keys %{$ACCOUNTDATA->{$asect}}) {
@@ -2686,6 +2696,7 @@ sub save_hk_preferences {
     log_message ("Saving hotkey preferences to $rc\n");
     return FALSE unless check_rc_file ($rc);
     return FALSE unless check_claws_not_running ();
+    return FALSE unless backup_resource ($rc);
     save_menurc ($rc, $HOTKEYS);
     return TRUE;
 }

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


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


More information about the Commits mailing list