Update ztest paths
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 6 Jul 2011 18:36:54 +0000 (11:36 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 6 Jul 2011 19:30:09 +0000 (12:30 -0700)
Unfortunately, ztest is hard coded to export the zdb utility to
be installed in a certain location.  When the packaging was updated
to install zdb in /sbin/ ztest was broken.  To fix this I'm updating
ztest to check both common install paths.

cmd/ztest/ztest.c

index f710534..6acba52 100644 (file)
@@ -4910,8 +4910,10 @@ ztest_run_zdb(char *pool)
        zbuf = umem_alloc(1024, UMEM_NOFAIL);
 
        VERIFY(realpath(getexecname(), bin) != NULL);
-       if (strncmp(bin, "/usr/sbin/ztest", 14) == 0) {
+       if (strncmp(bin, "/usr/sbin/ztest", 15) == 0) {
                strcpy(bin, "/usr/sbin/zdb"); /* Installed */
+       } else if (strncmp(bin, "/sbin/ztest", 11) == 0) {
+               strcpy(bin, "/sbin/zdb"); /* Installed */
        } else {
                strstr(bin, "/ztest/")[0] = '\0'; /* In-tree */
                strcat(bin, "/zdb/zdb");