]> git.proxmox.com Git - mirror_zfs.git/commit - cmd/ztest/ztest.c
Fix zdb calling behavior in ztest
authorChunwei Chen <david.chen@osnexus.com>
Fri, 20 Nov 2015 23:50:06 +0000 (15:50 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 2 Dec 2015 22:50:36 +0000 (14:50 -0800)
commit90aa094d6d77bf6f17a671ff76a84ae8232267d8
treee5860ffa2cf16611b71e174edd04092628f918f6
parentb0fe1adeb1f24192c9a3358a4c9a29a34b9537fe
Fix zdb calling behavior in ztest

The current zdb calling behaviour is really fragile, and is guaranteed to
segfault if ztest is not installed in either /sbin or /usr/sbin. With this
patch, the ztest will try to call zdb in the following order.

1. Use environmental variable ZDB_PATH if provided.
2. If ztest resides in build tree, guess the in tree zdb path.
3. Just pass zdb to popen and let it search it in PATH.

Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #3126
cmd/ztest/ztest.c