commit 002bec4

default  ·  2022-12-03 20:59:19 +0000 UTC
parent 85d0f40
In _object_user_cache(), don't call index_add() if link() fails.

It will most probably fail because the object is already there.
1 files changed,  +2, -2
M data.c
M data.c
+2, -2
 1@@ -657,8 +657,8 @@ int _object_user_cache(snac *snac, const char *id, const char *cachedir, int del
 2             index_del(idx, id);
 3     }
 4     else {
 5-        index_add(idx, id);
 6-        ret = link(ofn, cfn);
 7+        if ((ret = link(ofn, cfn)) != -1)
 8+            index_add(idx, id);
 9     }
10 
11     return ret;