summaryrefslogtreecommitdiffstats
path: root/module/zfs/spa_history.c
diff options
context:
space:
mode:
Diffstat (limited to 'module/zfs/spa_history.c')
-rw-r--r--module/zfs/spa_history.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/module/zfs/spa_history.c b/module/zfs/spa_history.c
index a65f16bcc..ce7d378c6 100644
--- a/module/zfs/spa_history.c
+++ b/module/zfs/spa_history.c
@@ -428,6 +428,7 @@ log_internal(history_internal_events_t event, spa_t *spa,
dmu_tx_t *tx, const char *fmt, va_list adx)
{
history_arg_t *ha;
+ va_list adx_copy;
/*
* If this is part of creating a pool, not everything is
@@ -437,11 +438,9 @@ log_internal(history_internal_events_t event, spa_t *spa,
return;
ha = kmem_alloc(sizeof (history_arg_t), KM_SLEEP);
- ha->ha_history_str = kmem_alloc(vsnprintf(NULL, 0, fmt, adx) + 1,
- KM_SLEEP);
-
- (void) vsprintf(ha->ha_history_str, fmt, adx);
-
+ va_copy(adx_copy, adx);
+ ha->ha_history_str = kmem_vasprintf(fmt, adx_copy);
+ va_end(adx_copy);
ha->ha_log_type = LOG_INTERNAL;
ha->ha_event = event;
ha->ha_zone = NULL;