snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit 0c83ef5a225980d3e63f3e4f63eefef69f535076
parent fa3904c5a7a4b4f75446b30b107467ae5f1ed6ee
Author: default <nobody@localhost>
Date:   Wed, 23 Nov 2022 18:58:07 +0100

New function list_add_md5().

Diffstat:
Mdata.c | 19+++++++++++++++++++
1 file changed, 19 insertions(+), 0 deletions(-)

diff --git a/data.c b/data.c @@ -288,6 +288,25 @@ int object_del(const char *id) } +int list_add_md5(const char *fn, const char *md5) +/* adds an md5 to a list */ +{ + int status = 200; + FILE *f; + + if ((f = fopen(fn, "a")) != NULL) { + flock(fileno(f), LOCK_EX); + + fprintf(f, "%s\n", md5); + fclose(f); + } + else + status = 500; + + return status; +} + + d_char *_follower_fn(snac *snac, char *actor) { xs *md5 = xs_md5_hex(actor, strlen(actor));