summaryrefslogtreecommitdiffstats
path: root/cmd/ztest
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2012-10-04 12:30:16 -0700
committerBrian Behlendorf <[email protected]>2012-10-04 13:19:10 -0700
commit5be98cfe2fd81145c9c16ddbe3b4d7d52f687157 (patch)
treeec63b3dbb07319b1dc5723b6724748a1d0521cc1 /cmd/ztest
parentfacbbe436670b4910475fb937a26468f7178b541 (diff)
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 <[email protected]>
Diffstat (limited to 'cmd/ztest')
-rw-r--r--cmd/ztest/ztest.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c
index bc2f56fb8..09f3d5678 100644
--- a/cmd/ztest/ztest.c
+++ b/cmd/ztest/ztest.c
@@ -736,7 +736,7 @@ process_options(int argc, char **argv)
char *isa;
int isalen;
- (void) realpath(getexecname(), cmd);
+ VERIFY(NULL != realpath(getexecname(), cmd));
if (0 != access(altdir, F_OK)) {
ztest_dump_core = B_FALSE;
fatal(B_TRUE, "invalid alternate ztest path: %s",
@@ -6030,8 +6030,8 @@ main(int argc, char **argv)
ASSERT3U(ztest_opts.zo_datasets, ==, ztest_shared_hdr->zh_ds_count);
/* Override location of zpool.cache */
- (void) asprintf((char **)&spa_config_path, "%s/zpool.cache",
- ztest_opts.zo_dir);
+ VERIFY(asprintf((char **)&spa_config_path, "%s/zpool.cache",
+ ztest_opts.zo_dir) != -1);
ztest_ds = umem_alloc(ztest_opts.zo_datasets * sizeof (ztest_ds_t),
UMEM_NOFAIL);