Added rewinddir before each readdir so that the directories are always

read properly
This commit is contained in:
Celine Mercier
2017-11-24 18:04:58 +01:00
parent 0998268955
commit ea73047fc7

View File

@ -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] == '.')