Diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Let go of a slot lock that cannot take its key
A failed truncate or key write returned with the descriptor still open, so the lock was held while the page rendered uncached and the file was left behind. It is removed before its last close, as every holder does.
Diffstat (limited to '')
-rw-r--r--source/cache.c3
1 file changed, 3 insertions, 0 deletions
diff --git a/source/cache.c b/source/cache.c
index 64b7148..004a84d 100644
--- a/source/cache.c
+++ b/source/cache.c
@@ -250,6 +250,9 @@ static int lock_slot(struct cache_slot *slot)
) {
err = errno;
fprintf(stderr, "[cgit] Unable to write %s: %s (%d)\n", slot->lock_path, strerror(err), err);
+ unlink(slot->lock_path);
+ close(slot->lock_fd);
+ slot->lock_fd = -1;
return err;
}
return 0;