summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src')
-rw-r--r--libglusterfs/src/fd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c
index 46b75cb10..73c244a60 100644
--- a/libglusterfs/src/fd.c
+++ b/libglusterfs/src/fd.c
@@ -172,7 +172,7 @@ fdentry_t *
__gf_fd_fdtable_copy_all_fds (fdtable_t *fdtable, uint32_t *count)
{
fdentry_t *fdentries = NULL;
- size_t cpy = 0;
+ int i = 0;
if (count == NULL) {
gf_log_callingfn ("fd", GF_LOG_WARNING, "!count");
@@ -187,8 +187,11 @@ __gf_fd_fdtable_copy_all_fds (fdtable_t *fdtable, uint32_t *count)
*count = fdtable->max_fds;
- cpy = fdtable->max_fds * sizeof (fdentry_t);
- memcpy ((void *)fdentries, (void *)fdtable->fdentries, cpy);
+ for (i = 0; i < fdtable->max_fds; i++) {
+ if (fdtable->fdentries[i].fd != NULL) {
+ fdentries[i].fd = fd_ref (fdtable->fdentries[i].fd);
+ }
+ }
out:
return fdentries;