mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-24 21:35:47 +03:00
Update: Report on readdir() errors #6610
This commit is contained in:
parent
23d64dd3ac
commit
3ec4fc6145
2 changed files with 16 additions and 1 deletions
|
@ -663,7 +663,21 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
|
|||
goto error;
|
||||
}
|
||||
|
||||
while ((dirent = csync_vio_readdir(ctx, dh))) {
|
||||
while (true) {
|
||||
// Get the next item in the directory
|
||||
errno = 0;
|
||||
dirent = csync_vio_readdir(ctx, dh);
|
||||
if (!dirent) {
|
||||
if (errno != 0) {
|
||||
// Note: Windows vio converts any error into EACCES
|
||||
qCWarning(lcUpdate, "readdir failed for file in %s - errno %d", uri, errno);
|
||||
goto error;
|
||||
}
|
||||
|
||||
// Normal case: End of items in directory
|
||||
break;
|
||||
}
|
||||
|
||||
/* Conversion error */
|
||||
if (dirent->path.isEmpty() && !dirent->original_path.isEmpty()) {
|
||||
ctx->status_code = CSYNC_STATUS_INVALID_CHARACTERS;
|
||||
|
|
|
@ -156,6 +156,7 @@ std::unique_ptr<csync_file_stat_t> csync_vio_local_readdir(csync_vio_handle_t *d
|
|||
// might be error, check!
|
||||
int dwError = GetLastError();
|
||||
if (dwError != ERROR_NO_MORE_FILES) {
|
||||
qCWarning(lcCSyncVIOLocal, "FindNextFile error %d", dwError);
|
||||
errno = EACCES; // no more files is fine. Otherwise EACCESS
|
||||
}
|
||||
return nullptr;
|
||||
|
|
Loading…
Reference in a new issue