summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2012-03-26 18:36:29 +0530
committerAnand Avati <avati@redhat.com>2012-03-26 15:09:20 -0700
commit98b98d6cd7d94bfae5b4a7b54b04b59bf9381df9 (patch)
treeb7e6789266c87b6897a02231cdb9eefd6be9fe59 /libglusterfs
parent78e5e52c51ceb2255ac28ab86a91ed887d334cf6 (diff)
libglusterfs/fd: ref fds while copying the fdentries.
Change-Id: I8973ec5d9858adfbdd6efc7cd596cf5d5af0e3cb BUG: 767862 Signed-off-by: Raghavendra G <raghavendra@gluster.com> Reviewed-on: http://review.gluster.com/3006 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'libglusterfs')
-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;