Don't remove lock, if other LCR is using it
authorAndreas Eversberg <jolly@eversberg.eu>
Sat, 28 Jul 2012 14:04:58 +0000 (16:04 +0200)
committerAndreas Eversberg <jolly@eversberg.eu>
Sun, 16 Dec 2012 09:10:33 +0000 (10:10 +0100)
main.c

diff --git a/main.c b/main.c
index 8efd316..140fc50 100644 (file)
--- a/main.c
+++ b/main.c
@@ -581,8 +581,10 @@ free:
        if (created_lock)
                flock(lockfd, LOCK_UN);
        if (lockfd >= 0) {
        if (created_lock)
                flock(lockfd, LOCK_UN);
        if (lockfd >= 0) {
-               chmod(lock, 0700);
-               unlink(lock);
+               if (created_lock) {
+                       chmod(lock, 0700);
+                       unlink(lock);
+               }
                close(lockfd);
        }
 
                close(lockfd);
        }