summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2016-08-15 08:45:13 +0000
committeravg <avg@FreeBSD.org>2016-08-15 08:45:13 +0000
commit6443a8a9cf1834a2dcdc2a1cb0fe602a99df93e2 (patch)
tree887b1530d4116d4aa1e32a3eba8ccb944f8157e7
parent1f0cc39531278e781936d5261f2c59959b7951d1 (diff)
downloadFreeBSD-src-6443a8a9cf1834a2dcdc2a1cb0fe602a99df93e2.zip
FreeBSD-src-6443a8a9cf1834a2dcdc2a1cb0fe602a99df93e2.tar.gz
MFC r303084: 6391 Override default SPA config location via environment
-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 7157d58..4931136 100644
--- a/cddl/contrib/opensolaris/cmd/zdb/zdb.c
+++ b/cddl/contrib/opensolaris/cmd/zdb/zdb.c
@@ -3558,12 +3558,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