From ea73047fc7bd0f9c69d05213b68d5b2ccd2b94b0 Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Fri, 24 Nov 2017 18:04:58 +0100 Subject: [PATCH] Added rewinddir before each readdir so that the directories are always read properly --- src/obiview.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/obiview.c b/src/obiview.c index eb23a5d..295f9cb 100644 --- a/src/obiview.c +++ b/src/obiview.c @@ -562,6 +562,7 @@ static bool view_exists(OBIDMS_p dms, const char* view_name) if (file_name == NULL) return -1; + rewinddir(dms->view_directory); while ((dp = readdir(dms->view_directory)) != NULL) { if ((dp->d_name)[0] == '.') @@ -581,6 +582,7 @@ static bool view_exists(OBIDMS_p dms, const char* view_name) if (file_name == NULL) return -1; + rewinddir(dms->view_directory); while ((dp = readdir(dms->view_directory)) != NULL) { if ((dp->d_name)[0] == '.') @@ -2537,6 +2539,7 @@ int obi_clean_unfinished_views(OBIDMS_p dms) d = 0; // Look for unfinished views and delete them + rewinddir(dms->view_directory); while ((dp = readdir(dms->view_directory)) != NULL) { if ((dp->d_name)[0] == '.') @@ -2754,6 +2757,7 @@ int obi_rollback_view(Obiview_p view) { strcpy(view_file_name, (view->infos)->name); strcat(view_file_name, ".obiview_unfinished"); + rewinddir((view->dms)->view_directory); while ((dp = readdir((view->dms)->view_directory)) != NULL) { if ((dp->d_name)[0] == '.')