mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-12-25 16:53:37 +00:00
New function index_unlock().
This commit is contained in:
parent
450863031b
commit
0f328d079c
1 changed files with 10 additions and 2 deletions
12
data.c
12
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue