commit 1941d00
default
·
2022-11-24 07:39:30 +0000 UTC
parent b0b052a
Refuse to store objects that are already here.
1 files changed,
+6,
-0
M
data.c
M
data.c
+6,
-0
1@@ -388,6 +388,12 @@ int object_add(const char *id, d_char *obj)
2 xs *fn = _object_fn(id);
3 FILE *f;
4
5+ if (mtime(fn) > 0.0) {
6+ /* object already here */
7+ srv_debug(0, xs_fmt("object_add object already here %s", id));
8+ return 204; /* No content */
9+ }
10+
11 if ((f = fopen(fn, "w")) != NULL) {
12 flock(fileno(f), LOCK_EX);
13