diff options
Diffstat (limited to 'xlators/storage/posix/src/posix.c')
| -rw-r--r-- | xlators/storage/posix/src/posix.c | 23 | 
1 files changed, 23 insertions, 0 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 549f1c4dc01..59b2535105b 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -4862,6 +4862,17 @@ posix_fill_readdir (fd_t *fd, DIR *dir, off_t off, size_t size,                  rewinddir (dir);          } else {                  seekdir (dir, off); +#ifndef GF_LINUX_HOST_OS +                if (telldir(dir) != off) { +                        gf_log (THIS->name, GF_LOG_ERROR, +                                "seekdir(%ld) failed on dir=%p: " +                                "Invalid argument (offset reused from " +                                "another DIR * structure?)", (long)off, dir); +                        errno = EINVAL; +                        count = -1; +                        goto out; +                } +#endif /* GF_LINUX_HOST_OS */          }          while (filled <= size) { @@ -4924,6 +4935,18 @@ posix_fill_readdir (fd_t *fd, DIR *dir, off_t off, size_t size,                  if (this_size + filled > size) {                          seekdir (dir, in_case); +#ifndef GF_LINUX_HOST_OS +                        if (telldir(dir) != in_case) { +                                gf_log (THIS->name, GF_LOG_ERROR, +                                        "seekdir(%ld) failed on dir=%p: " +                                        "Invalid argument (offset reused from " +                                        "another DIR * structure?)", +                                        (long)in_case, dir); +                                errno = EINVAL; +                                count = -1; +                                goto out; +                        } +#endif /* GF_LINUX_HOST_OS */                          break;                  }  | 
