diff options
author | default <nobody@localhost> | 2022-11-24 08:39:30 +0100 |
---|---|---|
committer | default <nobody@localhost> | 2022-11-24 08:39:30 +0100 |
commit | 1941d00650df6d6189d4d01fd4f268de7920a5a1 (patch) | |
tree | 209b8d5e0ea14199a23d4b9679e765b00c2635a4 | |
parent | b0b052ab3b724ded9b13e2703dc7f0138a0b9a4f (diff) |
Refuse to store objects that are already here.
-rw-r--r-- | data.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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); |