aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcrystfel/src/stream.c')
-rw-r--r--libcrystfel/src/stream.c5
1 files changed, 5 insertions, 0 deletions
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");