summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src
diff options
context:
space:
mode:
authorAnand V. Avati <avati@amp.gluster.com>2009-06-24 18:31:07 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-06-26 11:09:23 -0700
commitebc544b4d5be33e85810c06ce3a8b97a5aa026c1 (patch)
treedca0b576699f0beb13fae9e596e14bbc62877f2d /xlators/storage/posix/src
parent597c06064239a6053c58477316cefd06d921eec2 (diff)
posix_readdir: fill stat structure into dir entry
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
Diffstat (limited to 'xlators/storage/posix/src')
-rw-r--r--xlators/storage/posix/src/posix.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index b730b136f..0581bb7d8 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -3500,6 +3500,10 @@ posix_readdir (call_frame_t *frame, xlator_t *this,
off_t in_case = -1;
int32_t this_size = -1;
+ char * real_path = NULL;
+ int real_path_len = -1;
+ char * entry_path = NULL;
+ int entry_path_len = -1;
VALIDATE_OR_GOTO (frame, out);
VALIDATE_OR_GOTO (this, out);
@@ -3516,6 +3520,22 @@ posix_readdir (call_frame_t *frame, xlator_t *this,
}
pfd = (struct posix_fd *)(long)tmp_pfd;
+ real_path = pfd->path;
+ real_path_len = strlen (real_path);
+
+ entry_path_len = real_path_len + NAME_MAX;
+ entry_path = alloca (entry_path_len);
+
+ if (!entry_path) {
+ op_errno = errno;
+ gf_log (this->name, GF_LOG_ERROR,
+ "Out of memory.");
+ goto out;
+ }
+
+ strncpy (entry_path, real_path, entry_path_len);
+ entry_path[real_path_len] = '/';
+
dir = pfd->dir;
if (!dir) {
@@ -3580,6 +3600,9 @@ posix_readdir (call_frame_t *frame, xlator_t *this,
filled += this_size;
count ++;
+
+ strcpy (entry_path + real_path_len + 1, this_entry->d_name);
+ lstat (entry_path, &this_entry->d_stat);
}
op_ret = count;