Fix 'zpool history' sometimes fails without reporting any error
commit4dced31b98228f2fedbbe32de60ffcf8cc8f4fb3
authorLow-power <msl0000023508@gmail.com>
Fri, 15 Apr 2022 21:16:07 +0000 (16 05:16 +0800)
committerGitHub <noreply@github.com>
Fri, 15 Apr 2022 21:16:07 +0000 (15 14:16 -0700)
treeaa2b16e43ceea8c7edf69582e2d6bd4d8221d63a
parent0dd34a1955b06cdea460f2f1711b72536a5a511b
Fix 'zpool history' sometimes fails without reporting any error

The corresponding function 'zpool_get_history' in libzfs would printing
an error messages only when the ioctl call failed.

Add missing error reporting, specifically memory allocation failures
and error from 'zpool_history_unpack'.

Also avoid possibly reading of uninitialized 'err' variable in case
the requested offset pasts EOF.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Damian Szuberski <szuberskidamian@gmail.com>
Signed-off-by: WHR <msl0000023508@gmail.com>
Issue #13322
Closes #13320
lib/libzfs/libzfs_pool.c