Only call the expensive index_del() if unlink() did not fail.

This commit is contained in:
default 2022-11-26 06:20:41 +01:00
parent 14dd5b64c9
commit 8e7efad27f

4
data.c
View file

@ -566,8 +566,8 @@ int _object_user_cache(snac *snac, const char *id, const char *cachedir, int del
int ret; int ret;
if (del) { if (del) {
index_del(idx, id); // expensive; let it fail on processing? if ((ret = unlink(cfn)) != -1)
ret = unlink(cfn); index_del(idx, id);
} }
else { else {
index_add(idx, id); index_add(idx, id);