Browse Source

In _object_user_cache(), don't call index_add() if link() fails.

It will most probably fail because the object is already there.
default 2 years ago
parent
commit
002bec4def
1 changed files with 2 additions and 2 deletions
  1. 2 2
      data.c

+ 2 - 2
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;