|
@@ -558,19 +558,14 @@ fail:
|
|
|
--data->ftw.level;
|
|
|
data->ftw.base = previous_base;
|
|
|
|
|
|
-
|
|
|
- if (result == 0 && (data->flags & FTW_DEPTH))
|
|
|
- result = (*data->func) (data->dirbuf, st, FTW_DP, &data->ftw);
|
|
|
-
|
|
|
- if (old_dir
|
|
|
- && (data->flags & FTW_CHDIR)
|
|
|
+ if ((data->flags & FTW_CHDIR)
|
|
|
&& (result == 0
|
|
|
|| ((data->flags & FTW_ACTIONRETVAL)
|
|
|
&& (result != -1 && result != FTW_STOP))))
|
|
|
{
|
|
|
|
|
|
int done = 0;
|
|
|
- if (old_dir->stream != NULL)
|
|
|
+ if (old_dir && old_dir->stream != NULL)
|
|
|
if (__fchdir (dirfd (old_dir->stream)) == 0)
|
|
|
done = 1;
|
|
|
|
|
@@ -587,6 +582,10 @@ fail:
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ if (result == 0 && (data->flags & FTW_DEPTH))
|
|
|
+ result = (*data->func) (data->dirbuf, st, FTW_DP, &data->ftw);
|
|
|
+
|
|
|
return result;
|
|
|
}
|
|
|
|