Add screening of caller ID for remote (asterisk) connections
[lcr.git] / 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) {
-               chmod(lock, 0700);
-               unlink(lock);
+               if (created_lock) {
+                       chmod(lock, 0700);
+                       unlink(lock);
+               }
                close(lockfd);
        }