diff options
author | default <nobody@localhost> | 2023-02-22 21:52:24 +0100 |
---|---|---|
committer | default <nobody@localhost> | 2023-02-22 21:52:24 +0100 |
commit | 5a5835b4fa1f4c133f9152fb1a76b001a37dabb2 (patch) | |
tree | 35ca3a12043ff68d9bbd41e2aedb744cb7abb604 | |
parent | 0f328d079c6d6ee8c3fc79359725605c0bffdeb1 (diff) |
Deleted the index_lock() nonsense.
-rw-r--r-- | data.c | 32 |
1 files changed, 2 insertions, 30 deletions
@@ -244,32 +244,11 @@ double mtime_nl(const char *fn, int *n_link) /** indexes **/ -FILE *index_lock(const char *fn) -{ - xs *lck = xs_fmt("%s.lck", fn); - FILE *f = fopen(lck, "a"); - flock(fileno(f), LOCK_EX); - - return f; -} - - -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 */ { int status = 201; /* Created */ - FILE *l, *f; - - if ((l = index_lock(fn)) == NULL) - return 500; + FILE *f; if ((f = fopen(fn, "a")) != NULL) { flock(fileno(f), LOCK_EX); @@ -283,8 +262,6 @@ int index_add_md5(const char *fn, const char *md5) else status = 500; - index_unlock(l, fn); - return status; } @@ -301,10 +278,7 @@ int index_del_md5(const char *fn, const char *md5) /* deletes an md5 from an index */ { int status = 404; - FILE *l, *i, *o; - - if ((l = index_lock(fn)) == NULL) - return 500; + FILE *i, *o; if ((i = fopen(fn, "r")) != NULL) { flock(fileno(i), LOCK_EX); @@ -335,8 +309,6 @@ int index_del_md5(const char *fn, const char *md5) else status = 500; - index_unlock(l, fn); - return status; } |