From 5cbf5d94c719d1c7674a59c8009660197fc56af2 Mon Sep 17 00:00:00 2001 From: mohit84 Date: Thu, 22 Apr 2021 18:56:28 +0530 Subject: core: Avoid several dict OR key is NULL message in brick logs (#2344) Problem: dict_get_with_ref throw a message "dict or key is NULL" if dict or key is NULL. Solution: Before access a key check if dictionary is valid. > Fixes: #1909 > Change-Id: I50911679142b52f854baf20c187962a2a3698f2d > Signed-off-by: Mohit Agrawal > Cherry picked from commit de1b26d68e31b029a59e59a47b51a7e3e6fbfe22 > Reviewed on upstream link https://github.com/gluster/glusterfs/pull/1910 Fixes: #1909 Change-Id: I50911679142b52f854baf20c187962a2a3698f2d Signed-off-by: Mohit Agrawal --- xlators/features/index/src/index.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xlators/features/index') diff --git a/xlators/features/index/src/index.c b/xlators/features/index/src/index.c index 4abb2c73ce..f70f185b5b 100644 --- a/xlators/features/index/src/index.c +++ b/xlators/features/index/src/index.c @@ -2134,7 +2134,7 @@ index_fstat(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) int ret = -1; char *flag = NULL; - ret = dict_get_str(xdata, "link-count", &flag); + ret = dict_get_str_sizen(xdata, "link-count", &flag); if ((ret == 0) && (strcmp(flag, GF_XATTROP_INDEX_COUNT) == 0)) { STACK_WIND(frame, index_fstat_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fstat, fd, xdata); -- cgit