summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/gf-dirent.c
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2015-06-01 11:55:29 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2015-06-03 18:58:20 -0700
commit140b4fdefa21c00af3e6015fed86c632683ab01f (patch)
tree793d9a6d0b3739f8d62f16b717c1a6e2e0b0457e /libglusterfs/src/gf-dirent.c
parent731209a47e5ac5f2f0e3e840dfbef463dde0c014 (diff)
libglusterfs: Copy d_len and dict as well into dst dirent
Backport of: http://review.gluster.org/11026 Also, added memory allocation failure checks in light of the comments received @ http://review.gluster.org/#/c/10809/2/libglusterfs/src/gf-dirent.c, and http://review.gluster.org/#/c/10809/1/xlators/features/shard/src/shard.c Change-Id: Iad4736bba69e6977390f76d0c9eb64217a005b80 BUG: 1227576 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: http://review.gluster.org/11052 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'libglusterfs/src/gf-dirent.c')
-rw-r--r--libglusterfs/src/gf-dirent.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libglusterfs/src/gf-dirent.c b/libglusterfs/src/gf-dirent.c
index 99c0eb6441d..4c077e91871 100644
--- a/libglusterfs/src/gf-dirent.c
+++ b/libglusterfs/src/gf-dirent.c
@@ -182,7 +182,7 @@ gf_dirent_entry_free (gf_dirent_t *entry)
if (entry->inode)
inode_unref (entry->inode);
- list_del (&entry->list);
+ list_del_init (&entry->list);
GF_FREE (entry);
}
@@ -209,14 +209,20 @@ entry_copy (gf_dirent_t *source)
gf_dirent_t *sink = NULL;
sink = gf_dirent_for_name (source->d_name);
+ if (!sink)
+ return NULL;
sink->d_off = source->d_off;
sink->d_ino = source->d_ino;
sink->d_type = source->d_type;
sink->d_stat = source->d_stat;
+ sink->d_len = source->d_len;
if (source->inode)
sink->inode = inode_ref (source->inode);
+
+ if (source->dict)
+ sink->dict = dict_ref (source->dict);
return sink;
}