summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorGaurav Kumar Garg <garg.gaurav52@gmail.com>2015-12-22 12:05:39 +0530
committerAtin Mukherjee <amukherj@redhat.com>2015-12-28 06:59:22 -0800
commite4de816ae126b62906afcc1ce1216500b517e222 (patch)
treebe6bf9438d23a0d838e4efcaffa8fd8c1823adf6 /cli
parenta370013898585a87657ae41e4f266da5d98cc5d2 (diff)
cli: should not dereference NULL pointer while printing bitrot scrub status
When user execute bitrot scrub status command and scrubber is pending to do scrubbing then value of last_scrub time will be NULL. Currently cli is dereferencing NULL pointer in this case, That might lead to crash. Fix is to use proper check condition while printing scrub status. Change-Id: I3c4be8e25d089451c6ab77b16737c01d0348ee70 BUG: 1293558 Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com> Reviewed-on: http://review.gluster.org/13060 Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-rpc-ops.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 6288b01a6af..da9df4cc05e 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -10849,9 +10849,12 @@ gf_cli_print_bitrot_scrub_status (dict_t *dict)
cli_out ("%s: %"PRIu64 "\n", "Number of Unsigned files",
unsigned_files);
- cli_out ("%s: %s\n", "Last completed scrub time",
- (*last_scrub) ? last_scrub : "Scrubber pending to "
- "complete.");
+ if ((!last_scrub) || !strcmp (last_scrub, ""))
+ cli_out ("%s: %s\n", "Last completed scrub time",
+ "Scrubber pending to complete.");
+ else
+ cli_out ("%s: %s\n", "Last completed scrub time",
+ last_scrub);
/* Printing last scrub duration time in human readable form*/
days = scrub_time/86400;