]> git.proxmox.com Git - mirror_zfs-debian.git/commit
Verify the return value for warn_unused_result functions
authorBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 4 Oct 2012 19:30:16 +0000 (12:30 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 4 Oct 2012 20:19:10 +0000 (13:19 -0700)
commit5be98cfe2fd81145c9c16ddbe3b4d7d52f687157
treeec63b3dbb07319b1dc5723b6724748a1d0521cc1
parentfacbbe436670b4910475fb937a26468f7178b541
Verify the return value for warn_unused_result functions

Under Linux the following functions are flagged with the
attribute warn_unused_result, this triggers a warning when
ever they are used without checking the return value.

To handle this case we check the result VERIFY().  It's
better to detect this immediately on failure rather than
segfault farther down in the function.

  ../../cmd/ztest/ztest.c:6033:2: warning:
  ignoring return value of 'asprintf', declared with
  attribute warn_unused_result [-Wunused-result]
  ../../cmd/ztest/ztest.c:739:3: warning:
  ignoring return value of 'realpath', declared with
  attribute warn_unused_result [-Wunused-result]

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
cmd/ztest/ztest.c