commit 0c83ef5

default  ·  2022-11-23 17:58:07 +0000 UTC
parent fa3904c
New function list_add_md5().
1 files changed,  +19, -0
M data.c
M data.c
+19, -0
 1@@ -288,6 +288,25 @@ int object_del(const char *id)
 2 }
 3 
 4 
 5+int list_add_md5(const char *fn, const char *md5)
 6+/* adds an md5 to a list */
 7+{
 8+    int status = 200;
 9+    FILE *f;
10+
11+    if ((f = fopen(fn, "a")) != NULL) {
12+        flock(fileno(f), LOCK_EX);
13+
14+        fprintf(f, "%s\n", md5);
15+        fclose(f);
16+    }
17+    else
18+        status = 500;
19+
20+    return status;
21+}
22+
23+
24 d_char *_follower_fn(snac *snac, char *actor)
25 {
26     xs *md5 = xs_md5_hex(actor, strlen(actor));