summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-02-22 19:15:22 +0100
committerdefault <nobody@localhost>2023-02-22 19:15:22 +0100
commit0f328d079c6d6ee8c3fc79359725605c0bffdeb1 (patch)
treeb6bf17742dcd882bce6277862f5b685c8de074b4
parent450863031bdef9856de388a5e6bd440aa4bbfc83 (diff)
New function index_unlock().
-rw-r--r--data.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/data.c b/data.c
index 20bf13f..b32461c 100644
--- a/data.c
+++ b/data.c
@@ -254,6 +254,14 @@ FILE *index_lock(const char *fn)
}
+void index_unlock(FILE *f, const char *fn)
+{
+ xs *lck = xs_fmt("%s.lck", fn);
+ unlink(lck);
+ fclose(f);
+}
+
+
int index_add_md5(const char *fn, const char *md5)
/* adds an md5 to an index */
{
@@ -275,7 +283,7 @@ int index_add_md5(const char *fn, const char *md5)
else
status = 500;
- fclose(l);
+ index_unlock(l, fn);
return status;
}
@@ -327,7 +335,7 @@ int index_del_md5(const char *fn, const char *md5)
else
status = 500;
- fclose(l);
+ index_unlock(l, fn);
return status;
}