From 1941d00650df6d6189d4d01fd4f268de7920a5a1 Mon Sep 17 00:00:00 2001 From: default Date: Thu, 24 Nov 2022 08:39:30 +0100 Subject: [PATCH] Refuse to store objects that are already here. --- data.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/data.c b/data.c index e621eb2..19b8a0a 100644 --- a/data.c +++ b/data.c @@ -388,6 +388,12 @@ int object_add(const char *id, d_char *obj) xs *fn = _object_fn(id); FILE *f; + if (mtime(fn) > 0.0) { + /* object already here */ + srv_debug(0, xs_fmt("object_add object already here %s", id)); + return 204; /* No content */ + } + if ((f = fopen(fn, "w")) != NULL) { flock(fileno(f), LOCK_EX);