From d24fbedd018b4b08ff0359e0f5ec5d08dad38e61 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 12 Aug 2010 16:08:16 -0700 Subject: [PATCH] Honor spa_config_path for ztest '-f' option The new spa_config_path string was lost from ztest_run_zdb() during the onnv_141 merge. This commit puts it back in place so the '-f' option is properly honored. Additionally this function had been tweaked so ztest could be run in-tree but that broke running it when installed as a package. I've updated that chunk to detect where it's running and try to do the right thing in both cases. Closes #49 --- cmd/ztest/ztest.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c index adeeb2507672..5f383e605b59 100644 --- a/cmd/ztest/ztest.c +++ b/cmd/ztest/ztest.c @@ -4901,12 +4901,16 @@ ztest_run_zdb(char *pool) zdb = umem_alloc(MAXPATHLEN + MAXNAMELEN + 20, UMEM_NOFAIL); zbuf = umem_alloc(1024, UMEM_NOFAIL); - /* Designed to be run exclusively in the development tree */ VERIFY(realpath(getexecname(), bin) != NULL); - strstr(bin, "/ztest/")[0] = '\0'; + if (strncmp(bin, "/usr/sbin/ztest", 14) == 0) { + strcpy(bin, "/usr/sbin/zdb"); /* Installed */ + } else { + strstr(bin, "/ztest/")[0] = '\0'; /* In-tree */ + strcat(bin, "/zdb/zdb"); + } (void) sprintf(zdb, - "%s/zdb/zdb -bcc%s%s -U /tmp/zpool.cache %s", + "%s -bcc%s%s -U %s %s", bin, zopt_verbose >= 3 ? "s" : "", zopt_verbose >= 4 ? "v" : "",