From 002bec4deff7abf9823bbd80c0174785a0713de7 Mon Sep 17 00:00:00 2001 From: default Date: Sat, 3 Dec 2022 21:59:19 +0100 Subject: [PATCH] In _object_user_cache(), don't call index_add() if link() fails. It will most probably fail because the object is already there. --- data.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data.c b/data.c index 13c3372..619acf5 100644 --- a/data.c +++ b/data.c @@ -657,8 +657,8 @@ int _object_user_cache(snac *snac, const char *id, const char *cachedir, int del index_del(idx, id); } else { - index_add(idx, id); - ret = link(ofn, cfn); + if ((ret = link(ofn, cfn)) != -1) + index_add(idx, id); } return ret;