summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix.c
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2009-08-04 18:14:30 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-08-04 17:07:19 -0700
commitb834320d168feb54cf62bb1c0ae5af6f2704385e (patch)
tree62941ef0853a3e0975fbbcda2cb2015e4091a88b /xlators/storage/posix/src/posix.c
parenta313fd6657cb4a5310399edebe1f0c666e6a8d00 (diff)
add check for making sure 'fd' belongs to directory in posix-readdir
The root cause of this error is not found yet. But this check will make sure that there is no crash when the situation happens. Segfault can happen when a readdir() call comes over file's fd. Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 192 (sefault in posix-readdir) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=192
Diffstat (limited to 'xlators/storage/posix/src/posix.c')
-rw-r--r--xlators/storage/posix/src/posix.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 0581bb7..4c707ac 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -3519,6 +3519,13 @@ posix_readdir (call_frame_t *frame, xlator_t *this,
goto out;
}
pfd = (struct posix_fd *)(long)tmp_pfd;
+ if (!pfd->path) {
+ op_errno = EBADFD;
+ gf_log (this->name, GF_LOG_DEBUG,
+ "pfd does not have path set (possibly file "
+ "fd, fd=%p)", fd);
+ goto out;
+ }
real_path = pfd->path;
real_path_len = strlen (real_path);