From 1b7bccb236f4a07c0f0536c283c69ce79c0ffcb6 Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Wed, 31 Oct 2018 17:51:10 +0100 Subject: [PATCH] Small improvement when checking if a view exists --- src/obiview.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/obiview.c b/src/obiview.c index 15bb284..0fc21ae 100755 --- a/src/obiview.c +++ b/src/obiview.c @@ -601,7 +601,7 @@ static bool view_exists(OBIDMS_p dms, const char* view_name) } -static bool view_is_finished(OBIDMS_p dms, const char* view_name) +static int view_is_finished(OBIDMS_p dms, const char* view_name) { struct dirent* dp; char* file_name; @@ -2844,6 +2844,7 @@ int obi_delete_view(OBIDMS_p dms, const char* view_name) char* view_relative_path; char* view_full_path; struct dirent* dp; + int finished_view; // Check that the view exists if (view_exists(dms, view_name) == false) @@ -2854,7 +2855,15 @@ int obi_delete_view(OBIDMS_p dms, const char* view_name) } // Check that the view is finished - if (view_is_finished(dms, view_name) == false) + finished_view = view_is_finished(dms, view_name); + if (finished_view == -1) + { + obi_set_errno(OBIVIEW_ERROR); + obidebug(1, "\nError trying to check if view '%s' is finished", view_name); + return -1; + } + + if (finished_view == 0) { obi_set_errno(OBIVIEW_ERROR); obidebug(1, "\nError trying to delete a view: view '%s' is not finished", view_name);