Small improvement when checking if a view exists

This commit is contained in:
Celine Mercier
2018-10-31 17:51:10 +01:00
parent d09aa43133
commit 1b7bccb236

View File

@ -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);