From 1a90c5e819f083c951a760060b3936b8615fdce5 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 10 Jul 2018 11:30:16 +0200 Subject: Delete mosflm.lp and SUMMARY when cleaning up temporary folder --- libcrystfel/src/mosflm.c | 26 -------------------------- src/im-sandbox.c | 5 +++++ 2 files changed, 5 insertions(+), 26 deletions(-) diff --git a/libcrystfel/src/mosflm.c b/libcrystfel/src/mosflm.c index 9dc99162..56f2ad77 100644 --- a/libcrystfel/src/mosflm.c +++ b/libcrystfel/src/mosflm.c @@ -875,20 +875,6 @@ static void chop_word(char *s) } -static int file_exists(const char *filename) -{ - struct stat s; - - if ( stat(filename, &s) != 0 ) { - if ( errno == ENOENT ) return 0; - ERROR("Failed to check for %s.\n", filename); - exit(1); - } - - return 1; -} - - const char *mosflm_probe(UnitCell *cell) { pid_t pid; @@ -899,15 +885,6 @@ const char *mosflm_probe(UnitCell *cell) int ok = 0; int l; - /* Mosflm will write mosflm.lp and SUMMARY when we test it, which we are - * are going to delete afterwards. Better check they don't exist first, - * in case they were important. */ - if ( file_exists("mosflm.lp") || file_exists("SUMMARY") ) { - ERROR("Please move or delete mosflm.lp and SUMMARY from the " - "working directory first.\n"); - exit(1); - } - pid = forkpty(&pty, NULL, NULL, NULL); if ( pid == -1 ) { return NULL; @@ -947,9 +924,6 @@ const char *mosflm_probe(UnitCell *cell) close(pty); waitpid(pid, &status, 0); - unlink("mosflm.lp"); - unlink("SUMMARY"); - if ( !ok ) return NULL; if ( cell_has_parameters(cell) ) return "mosflm-cell-nolatt,mosflm-latt-nocell"; diff --git a/src/im-sandbox.c b/src/im-sandbox.c index ad27641b..f8913f0a 100644 --- a/src/im-sandbox.c +++ b/src/im-sandbox.c @@ -869,6 +869,11 @@ static void delete_temporary_folder(const char *tmpdir, int n_proc) path = calloc(len+64, 1); if ( (workerdir == NULL) || (path == NULL) ) return; + snprintf(path, 127, "%s/mosflm.lp", tmpdir); + unlink(path); + snprintf(path, 127, "%s/SUMMARY", tmpdir); + unlink(path); + for ( slot=0; slot