]> git.e2factory.org Git - e2factory.git/commitdiff
lock: provide instructions to fix a locked chroot
authorTobias Ulmer <tu@emlix.com>
Mon, 12 Nov 2018 18:08:12 +0000 (19:08 +0100)
committerTobias Ulmer <tu@emlix.com>
Mon, 10 Dec 2018 17:00:11 +0000 (18:00 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/lock.lua

index 2fda76c8557ad572957721814b2126c072c8c4bc..22be6a8a57ded6f892bb773941b8ee180d6a8663 100644 (file)
@@ -48,10 +48,13 @@ end
 -- @return True on success, false on error.
 -- @return Err object on failure.
 function lock.lock(l, dir)
-    local e = err.new("locking failed")
-
     local rc, re = e2lib.mkdir(dir)
-    if not rc then
+    if not rc and err.eccmp(re, 'EEXIST') then
+        local e = err.new('chroot already in use!')
+        e:append('if this is an error, try rmdir %q', dir)
+        return false, e
+    elseif not rc then
+        local e = err.new("locking failed")
         return false, e:cat(re)
     end