mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-09 19:50:26 +03:00
Refuse to store objects that are already here.
This commit is contained in:
parent
b0b052ab3b
commit
1941d00650
6
data.c
6
data.c
@ -388,6 +388,12 @@ int object_add(const char *id, d_char *obj)
|
|||||||
xs *fn = _object_fn(id);
|
xs *fn = _object_fn(id);
|
||||||
FILE *f;
|
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) {
|
if ((f = fopen(fn, "w")) != NULL) {
|
||||||
flock(fileno(f), LOCK_EX);
|
flock(fileno(f), LOCK_EX);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user