Commit 978e647f authored by jyang's avatar jyang

branches/5.1: Fix bug #50691, AIX implementation of readdir_r

causes InnoDB errors. readdir_r() returns an non-NULL value
in the case of reaching the end of a directory. It should
not be treated as an error return.

rb://238 approved by Marko
parent 26740944
...@@ -759,7 +759,15 @@ next_file: ...@@ -759,7 +759,15 @@ next_file:
#ifdef HAVE_READDIR_R #ifdef HAVE_READDIR_R
ret = readdir_r(dir, (struct dirent*)dirent_buf, &ent); ret = readdir_r(dir, (struct dirent*)dirent_buf, &ent);
if (ret != 0) { if (ret != 0
#ifdef UNIV_AIX
/* On AIX, only if we got non-NULL 'ent' (result) value and
a non-zero 'ret' (return) value, it indicates a failed
readdir_r() call. An NULL 'ent' with an non-zero 'ret'
would indicate the "end of the directory" is reached. */
&& ent != NULL
#endif
) {
fprintf(stderr, fprintf(stderr,
"InnoDB: cannot read directory %s, error %lu\n", "InnoDB: cannot read directory %s, error %lu\n",
dirname, (ulong)ret); dirname, (ulong)ret);
......
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