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;
if (del) {
index_del(idx, id); // expensive; let it fail on processing?
ret = unlink(cfn);
if ((ret = unlink(cfn)) != -1)
index_del(idx, id);
}
else {
index_add(idx, id);