summaryrefslogtreecommitdiff
path: root/client/mysql_upgrade.c
diff options
context:
space:
mode:
Diffstat (limited to 'client/mysql_upgrade.c')
-rw-r--r--client/mysql_upgrade.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index 85722343388..4e17089593f 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -268,12 +268,12 @@ static void add_one_option_cnf_file(DYNAMIC_STRING *ds,
}
static my_bool
-get_one_option(int optid, const struct my_option *opt,
- char *argument)
+get_one_option(const struct my_option *opt, char *argument,
+ const char *filename __attribute__((unused)))
{
my_bool add_option= TRUE;
- switch (optid) {
+ switch (opt->id) {
case '?':
printf("%s Ver %s Distrib %s, for %s (%s)\n",
@@ -317,7 +317,7 @@ get_one_option(int optid, const struct my_option *opt,
case 'b': /* --basedir */
case 'd': /* --datadir */
fprintf(stderr, "%s: the '--%s' option is always ignored\n",
- my_progname, optid == 'b' ? "basedir" : "datadir");
+ my_progname, opt->id == 'b' ? "basedir" : "datadir");
/* FALLTHROUGH */
case 'k': /* --version-check */
@@ -383,11 +383,20 @@ static int run_command(char* cmd,
if (opt_verbose >= 4)
puts(cmd);
- if (!(res_file= my_popen(cmd, IF_WIN("rt","r"))))
+ if (!(res_file= my_popen(cmd, "r")))
die("popen(\"%s\", \"r\") failed", cmd);
while (fgets(buf, sizeof(buf), res_file))
{
+#ifdef _WIN32
+ /* Strip '\r' off newlines. */
+ size_t len = strlen(buf);
+ if (len > 1 && buf[len - 2] == '\r' && buf[len - 1] == '\n')
+ {
+ buf[len - 2] = '\n';
+ buf[len - 1] = 0;
+ }
+#endif
DBUG_PRINT("info", ("buf: %s", buf));
if(ds_res)
{