Commit b8f97058 authored by vasil's avatar vasil

branches/zip:

When scanning a directory readdir() is called and stat() after it,
if a file is deleted between the two calls stat will fail and the
whole precedure will fail. Change this behavior to continue with the
next entry if stat() fails because of nonexistent file. This is
transparent change as it will make it look as if the file was deleted
before the readdir() call.

This change is needed in order to fix
https://svn.innodb.com/mantis/view.php?id=174
in which we need to abort if os_file_readdir_next_file()
encounters "real" errors.

Approved by:	Marko, Pekka (rb://177)
parent a96316c4
......@@ -832,6 +832,23 @@ next_file:
ret = stat(full_path, &statinfo);
if (ret) {
if (errno == ENOENT) {
/* readdir() returned a file that does not exist,
it must have been deleted in the meantime. Do what
would have happened if the file was deleted before
readdir() - ignore and go to the next entry.
If this is the last entry then info->name will still
contain the name of the deleted file when this
function returns, but this is not an issue since the
caller shouldn't be looking at info when end of
directory is returned. */
ut_free(full_path);
goto next_file;
}
os_file_handle_error_no_exit(full_path, "stat");
ut_free(full_path);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment