summaryrefslogtreecommitdiffstats
path: root/xlators/storage
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:20 -0700
commitad7909163aef151b15638110119fb9adaf3dbcee (patch)
treefcc574a1ac3adc109b626ce50e767a7b42a12727 /xlators/storage
parentc4cf372fbc70e7354597692b385691149f163d2a (diff)
posix_readdir: fill stat structure into dir entry
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
Diffstat (limited to 'xlators/storage')
-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 301bc4872..a2e4ad761 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;