summaryrefslogtreecommitdiffstats
path: root/cddl
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2016-08-15 08:44:48 +0000
committeravg <avg@FreeBSD.org>2016-08-15 08:44:48 +0000
commit399bce4a6d7beef1dc58e330c47c04965b97cd2e (patch)
treee4b12346d870495bb6ddb918759e253091179957 /cddl
parent93a2f27720646377824bafa4957633a395ca4f1e (diff)
downloadFreeBSD-src-399bce4a6d7beef1dc58e330c47c04965b97cd2e.zip
FreeBSD-src-399bce4a6d7beef1dc58e330c47c04965b97cd2e.tar.gz
MFC r303084: 6391 Override default SPA config location via environment
Diffstat (limited to 'cddl')
-rw-r--r--cddl/contrib/opensolaris/cmd/zdb/zdb.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/cddl/contrib/opensolaris/cmd/zdb/zdb.c b/cddl/contrib/opensolaris/cmd/zdb/zdb.c
index 7c08c5f..564460a 100644
--- a/cddl/contrib/opensolaris/cmd/zdb/zdb.c
+++ b/cddl/contrib/opensolaris/cmd/zdb/zdb.c
@@ -3559,12 +3559,22 @@ main(int argc, char **argv)
nvlist_t *policy = NULL;
uint64_t max_txg = UINT64_MAX;
int rewind = ZPOOL_NEVER_REWIND;
+ char *spa_config_path_env;
(void) setrlimit(RLIMIT_NOFILE, &rl);
(void) enable_extended_FILE_stdio(-1, -1);
dprintf_setup(&argc, argv);
+ /*
+ * If there is an environment variable SPA_CONFIG_PATH it overrides
+ * default spa_config_path setting. If -U flag is specified it will
+ * override this environment variable settings once again.
+ */
+ spa_config_path_env = getenv("SPA_CONFIG_PATH");
+ if (spa_config_path_env != NULL)
+ spa_config_path = spa_config_path_env;
+
while ((c = getopt(argc, argv,
"bcdhilmMI:suCDRSAFLXx:evp:t:U:P")) != -1) {
switch (c) {
OpenPOWER on IntegriCloud