Fix unchecked return values and unused return values
Motivation and Context
Coverity complained about unchecked return values and unused values that turned out to be unused return values.
Description
Different approaches were used to handle the different cases.
- cmd/zdb/zdb.c: VERIFY0 was used since the existing code had no error handling.
- cmd/zed/agents/zfs_retire.c: We dismiss the return value with
(void)because the values are expected to be potentially unset. - cmd/zpool_influxdb/zpool_influxdb.c: We dismiss the return value with
(void)because the values are expected to be potentially unset. - cmd/ztest.c: VERIFY0 was used since we want failures if something goes wrong in ztest.
- module/zfs/dsl_dir.c: We dismiss the return value with
(void)because there is no guarantee that the zap entry will always be there. For example, old pools imported readonly would not have it and we do not want to fail here because of that. - module/zfs/zfs_fm.c:
fnvlist_add_*()was used since the allocations sleep and thus can never fail. - module/zfs/zvol.c: We dismiss the return value with
(void)because we do not need it. This matches what is already done in the analogouszfs_replay_write2().
As for unused return values, they were all in places where there was error handling, so logic was added to handle the return values.
How Has This Been Tested?
A build test was done.
Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Performance enhancement (non-breaking change which improves efficiency)
- [ ] Code cleanup (non-breaking change which makes code smaller or more readable)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
- [ ] Documentation (a change to man pages or other documentation)
Checklist:
- [x] My code follows the OpenZFS code style requirements.
- [ ] I have updated the documentation accordingly.
- [x] I have read the contributing document.
- [ ] I have added tests to cover my changes.
- [ ] I have run the ZFS Test Suite with this change applied.
- [x] All commit messages are properly formatted and contain
Signed-off-by.
There's a checkstyle warning introduced by this change which needs to be resolved.
Fixed.
One day, I should integrate checkstyle into the git commit command on my machine so these are caught early.
I have amended this to handle some unchecked return values reported by coverity in the ZTS.