summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@sun.com>2009-11-03 13:59:31 +0400
committerSergey Vojtovich <svoj@sun.com>2009-11-03 13:59:31 +0400
commit5bd0efc83dc13945f072c6d252f32c63a8878836 (patch)
treefba5c22f54d4c73d76e1e85e47d818334f737fd4 /storage
parenta9c7c79a0a8ed7e143c65f00c5b80a80db46d8cc (diff)
downloadmariadb-git-5bd0efc83dc13945f072c6d252f32c63a8878836.tar.gz
Applying InnoDB plugin snashot
Detailed revision comments: r6048 | vasil | 2009-10-09 08:42:55 +0300 (Fri, 09 Oct 2009) | 16 lines 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)
Diffstat (limited to 'storage')
-rw-r--r--storage/innodb_plugin/os/os0file.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/storage/innodb_plugin/os/os0file.c b/storage/innodb_plugin/os/os0file.c
index a1d3bad2add..0cb76d1796f 100644
--- a/storage/innodb_plugin/os/os0file.c
+++ b/storage/innodb_plugin/os/os0file.c
@@ -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);