mirror_zfs/tests/zfs-tests/cmd
Richard Yao 2a493a4c71
Fix unchecked return values and unused return values
Coverity complained about unchecked return values and unused values that
turned out to be unused return values.

Different approaches were used to handle the different cases of
unchecked return values:

* cmd/zdb/zdb.c: VERIFY0 was used in one place since the existing code
  had no error handling. An error message was printed in another to
  match the rest of the code.

* cmd/zed/agents/zfs_retire.c: We dismiss the return value with `(void)`
  because the value is 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 analogous
  `zfs_replay_write2()`.

* tests/zfs-tests/cmd/draid.c: We suppress one return value with
  `(void)` since the code handles errors already. The other return value
  is handled by switching to `fnvlist_lookup_uint8_array()`.

* tests/zfs-tests/cmd/file/file_fadvise.c: We add error handling.

* tests/zfs-tests/cmd/mmap_sync.c: We add error handling for munmap, but
  ignore failures on remove() with (void) since it is expected to be
  able to fail.

* tests/zfs-tests/cmd/mmapwrite.c: We add error handling.

As for unused return values, they were all in places where there was
error handling, so logic was added to handle the return values.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #13920
2022-09-23 16:52:03 -07:00
..
checksum Fix BLAKE3 tuneable and module loading on Linux and FreeBSD 2022-09-16 14:25:53 -07:00
file Fix unchecked return values and unused return values 2022-09-23 16:52:03 -07:00
linux_dos_attributes tests: cmd: don't recurse 2022-04-01 17:58:23 -07:00
.gitignore Add Linux posix_fadvise support 2022-09-08 10:29:41 -07:00
badsend.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
btree_test.c tests: cmd: don't recurse 2022-04-01 17:58:23 -07:00
chg_usr_exec.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
cp_files.c tests: move C test helpers into test cmd 2022-04-01 18:01:39 -07:00
ctime.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
devname2devid.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
dir_rd_update.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
dosmode_readonly_write.c tests: move C test helpers into test cmd 2022-04-01 18:01:39 -07:00
draid.c Fix unchecked return values and unused return values 2022-09-23 16:52:03 -07:00
ereports.c tests: move C test helpers into test cmd 2022-04-01 18:01:39 -07:00
get_diff.c Enable -Wwrite-strings 2022-06-29 14:08:54 -07:00
getversion.c tests: cmd: don't recurse 2022-04-01 17:58:23 -07:00
libzfs_input_check.c Implement a new type of zfs receive: corrective receive (-c) 2022-07-28 15:52:46 -07:00
Makefile.am Add Linux posix_fadvise support 2022-09-08 10:29:41 -07:00
mkbusy.c Enable -Wwrite-strings 2022-06-29 14:08:54 -07:00
mkfile.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
mkfiles.c Enable -Wwrite-strings 2022-06-29 14:08:54 -07:00
mktree.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
mmap_exec.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
mmap_libaio.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
mmap_seek.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
mmap_sync.c Fix unchecked return values and unused return values 2022-09-23 16:52:03 -07:00
mmapwrite.c Fix unchecked return values and unused return values 2022-09-23 16:52:03 -07:00
nvlist_to_lua.c Enable -Wwrite-strings 2022-06-29 14:08:54 -07:00
readmmap.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
rename_dir.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
rm_lnkcnt_zero_file.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
send_doall.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
stride_dd.c Enable -Wwrite-strings 2022-06-29 14:08:54 -07:00
suid_write_to_file.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
threadsappend.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
truncate_test.c tests: move C test helpers into test cmd 2022-04-01 18:01:39 -07:00
user_ns_exec.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
xattrtest.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zed_fd_spill-zedlet.c tests: move C test helpers into test cmd 2022-04-01 18:01:39 -07:00
zfs_diff-socket.c tests: move C test helpers into test cmd 2022-04-01 18:01:39 -07:00