Package:     backup2l
Subject:     fix misleading warning (issue #24)
Author:      Gundolf Kiefer <gkiefer@users.noreply.github.com>
Origin:      upstream, https://github.com/gkiefer/backup2l/commit/bca4d8c3f2c617e03a415abbed7d3319bccc1845
Forwarded:   not needed
Last-Update: 2023-06-07

The fix (and proper solution) is to let the tool stop with an error in this case.
Leaving 'backup -s' running without a successful lock can result in other faulty
behavior.
---

diff -urN s31/backup2l s32/backup2l
--- s31/backup2l	2025-04-25 15:34:15.701586209 +0200
+++ s32/backup2l	2025-04-25 15:42:30.775488713 +0200
@@ -345,6 +345,13 @@
         fi
     fi
     echo $$ > $BACKUP_DIR/$VOLNAME.lock
+    if [[ "`cat $BACKUP_DIR/$VOLNAME.lock 2>/dev/null`" != "$$" ]]; then
+      echo "ERROR: Failed to lock backup volume."
+      echo
+      echo "For some reason, the lock file '$BACKUP_DIR/$VOLNAME.lock' could not be created."
+      echo "Maybe I do not have write permissions for '$BACKUP_DIR'?"
+      exit 3
+    fi
     # Locking: End
     VOL_IS_LOCKED=1
 }
