summaryrefslogtreecommitdiffstats
path: root/xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.c')
-rw-r--r--xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.c b/xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.c
index 0afd7ea05b1..2f9aaf31a52 100644
--- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.c
+++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.c
@@ -55,9 +55,12 @@ void
br_update_scrub_finish_time (br_scrub_stats_t *scrub_stat, char *timestr,
struct timeval *tv)
{
+ int lst_size = 0;
+
if (!scrub_stat)
return;
+ lst_size = sizeof (scrub_stat->last_scrub_time);
pthread_mutex_lock (&scrub_stat->lock);
{
scrub_stat->scrub_end_tv.tv_sec = tv->tv_sec;
@@ -67,7 +70,8 @@ br_update_scrub_finish_time (br_scrub_stats_t *scrub_stat, char *timestr,
scrub_stat->scrub_start_tv.tv_sec;
strncpy (scrub_stat->last_scrub_time, timestr,
- sizeof (scrub_stat->last_scrub_time));
+ lst_size-1);
+ scrub_stat->last_scrub_time[lst_size-1] = '\0';
}
pthread_mutex_unlock (&scrub_stat->lock);
}