summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-08-07 06:38:19 +0200
committerdefault <nobody@localhost>2023-08-07 06:38:19 +0200
commita3f1387daaaa15253a242876aa0e9e4639e8e23d (patch)
tree11d2dda4c56446b878790117f6e9b75185301ba8
parentbf79c8c3707d020643387567cbcbb24461359f77 (diff)
Only create the limited/ folder in calling limit().
-rw-r--r--data.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/data.c b/data.c
index 61438b7..e1e5484 100644
--- a/data.c
+++ b/data.c
@@ -1506,11 +1506,9 @@ int limited(snac *user, const char *id, int cmd)
/* announce messages from a followed (0: check, 1: limit; 2: unlimit) */
{
int ret = 0;
- xs *fn = xs_fmt("%s/limited/", user->basedir);
- mkdirx(fn);
-
+ xs *dir = xs_fmt("%s/limited", user->basedir);
xs *md5 = xs_md5_hex(id, strlen(id));
- fn = xs_str_cat(fn, md5);
+ xs *fn = xs_fmt("%s/%s", dir, md5);
switch (cmd) {
case 0: /** check **/
@@ -1518,6 +1516,8 @@ int limited(snac *user, const char *id, int cmd)
break;
case 1: /** limit **/
+ mkdirx(dir);
+
if (mtime(fn) > 0.0)
ret = -1;
else {