aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cache.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/cache.c b/cache.c
index 1c843ba..e70af13 100644
--- a/cache.c
+++ b/cache.c
@@ -185,6 +185,8 @@ static int lock_slot(struct cache_slot *slot)
slot->lock_fd = -1;
return saved_errno;
}
+ if (ftruncate(slot->lock_fd, 0) < 0)
+ return errno;
if (xwrite(slot->lock_fd, slot->key, slot->keylen + 1) < 0)
return errno;
return 0;