summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorunknown <tsmith@siva.hindu.god>2007-01-18 10:34:51 -0700
committerunknown <tsmith@siva.hindu.god>2007-01-18 10:34:51 -0700
commitc7b6685f9fb33f88eb10c68366f3e1f99173f2ad (patch)
tree00cce2c3a12803a2531276fd42772d9586b6157e /client
parent73dcec767800c00ce55922d1673da09de13ac54f (diff)
parent104ce0dce92391e28ec49008fd4825f0c7773e6b (diff)
downloadmariadb-git-c7b6685f9fb33f88eb10c68366f3e1f99173f2ad.tar.gz
Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.1-maint
into siva.hindu.god:/home/tsmith/m/bk/mrg-jan17/maint/51 client/mysql_upgrade.c: Auto merged storage/myisam/mi_packrec.c: Use local
Diffstat (limited to 'client')
-rw-r--r--client/mysql_upgrade.c77
1 files changed, 57 insertions, 20 deletions
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index e1372b2dbbd..15f105fd8fe 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -470,7 +470,12 @@ int main(int argc, char **argv)
load_defaults("my", load_default_groups, &argc, &argv);
- if (handle_options(&argc, &argv, my_long_options, get_one_option))
+ /*
+ Must init_dynamic_string before handle_options because string is freed
+ at error label.
+ */
+ if (init_dynamic_string(&cmdline, NULL, 2 * FN_REFLEN + 128, FN_REFLEN) ||
+ handle_options(&argc, &argv, my_long_options, get_one_option))
{
ret= 1;
goto error;
@@ -478,11 +483,6 @@ int main(int argc, char **argv)
if (tty_password)
opt_password= get_tty_password(NullS);
- if (init_dynamic_string(&cmdline, NULL, 2 * FN_REFLEN + 128, FN_REFLEN))
- {
- ret= 1;
- goto error;
- }
if (!basedir)
{
my_getwd(path, sizeof(path), MYF(0));
@@ -565,17 +565,34 @@ int main(int argc, char **argv)
goto error;
}
else
- dynstr_set(&cmdline, path);
+ {
+#ifdef __WIN__
+ /* Windows requires an extra pair of quotes around the entire string. */
+ dynstr_set(&cmdline, "\"");
+#else
+ dynstr_set(&cmdline, "");
+#endif /* __WIN__ */
+ dynstr_append_os_quoted(&cmdline, path, NullS);
+ }
if (defaults_to_use)
{
- dynstr_append(&cmdline, " --defaults-extra-file=");
- dynstr_append(&cmdline, defaults_to_use);
+ dynstr_append(&cmdline, " ");
+ dynstr_append_os_quoted(&cmdline, "--defaults-extra-file=",
+ defaults_to_use, NullS);
}
-
- dynstr_append(&cmdline, " --check-upgrade --all-databases"
- " --auto-repair --user=");
- dynstr_append(&cmdline, user);
+
+ dynstr_append(&cmdline, " ");
+ dynstr_append_os_quoted(&cmdline, "--check-upgrade", NullS);
+ dynstr_append(&cmdline, " ");
+ dynstr_append_os_quoted(&cmdline, "--all-databases", NullS);
+ dynstr_append(&cmdline, " ");
+ dynstr_append_os_quoted(&cmdline, "--auto-repair", NullS);
+ dynstr_append(&cmdline, " ");
+ dynstr_append_os_quoted(&cmdline, "--user=", user, NullS);
+#ifdef __WIN__
+ dynstr_append(&cmdline, "\"");
+#endif /* __WIN__ */
if (opt_verbose)
printf("Running %s\n", cmdline.str);
@@ -604,7 +621,15 @@ fix_priv_tables:
goto error;
}
else
- dynstr_set(&cmdline, path);
+ {
+#ifdef __WIN__
+ /* Windows requires an extra pair of quotes around the entire string. */
+ dynstr_set(&cmdline, "\"");
+#else
+ dynstr_set(&cmdline, "");
+#endif /* __WIN__ */
+ dynstr_append_os_quoted(&cmdline, path, NullS);
+ }
if (find_file(MYSQL_FIX_PRIV_TABLES_NAME, basedir, MYF(0),
path, sizeof(path),
@@ -626,13 +651,25 @@ fix_priv_tables:
if (defaults_to_use)
{
- dynstr_append(&cmdline, " --defaults-extra-file=");
- dynstr_append(&cmdline, defaults_to_use);
+ dynstr_append(&cmdline, " ");
+ dynstr_append_os_quoted(&cmdline, "--defaults-extra-file=",
+ defaults_to_use, NullS);
}
- dynstr_append(&cmdline, " --force --no-auto-rehash --batch --user=");
- dynstr_append(&cmdline, user);
- dynstr_append(&cmdline, " mysql < ");
- dynstr_append(&cmdline, script_line);
+ dynstr_append(&cmdline, " ");
+ dynstr_append_os_quoted(&cmdline, "--force", NullS);
+ dynstr_append(&cmdline, " ");
+ dynstr_append_os_quoted(&cmdline, "--no-auto-rehash", NullS);
+ dynstr_append(&cmdline, " ");
+ dynstr_append_os_quoted(&cmdline, "--batch", NullS);
+ dynstr_append(&cmdline, " ");
+ dynstr_append_os_quoted(&cmdline, "--user=", user, NullS);
+ dynstr_append(&cmdline, " ");
+ dynstr_append_os_quoted(&cmdline, "--database=mysql", NullS);
+ dynstr_append(&cmdline, " < ");
+ dynstr_append_os_quoted(&cmdline, script_line, NullS);
+#ifdef __WIN__
+ dynstr_append(&cmdline, "\"");
+#endif /* __WIN__ */
if (opt_verbose)
printf("Running %s\n", cmdline.str);