From 6db9619ba5172b9e416a5939d375f5119aa652ff Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 16 Sep 2021 17:21:20 +0200 Subject: Refuse to overwrite an existing stream With online processing, we might end up with a very long stream. It should not be so easily deleted if indexamajig is restarted! --- libcrystfel/src/stream.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libcrystfel') diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c index 093e34e4..67297e49 100644 --- a/libcrystfel/src/stream.c +++ b/libcrystfel/src/stream.c @@ -1167,6 +1167,11 @@ Stream *stream_open_for_write(const char *filename, st->dtempl_write = dtempl; st->dtempl_read = NULL; + if ( file_exists(filename) ) { + ERROR("Refusing to overwrite stream '%s'!\n", filename); + return NULL; + } + st->fh = fopen(filename, "w"); if ( st->fh == NULL ) { ERROR("Failed to open stream.\n"); -- cgit v1.2.3