diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2019-11-21 01:51:34 +0100 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2019-11-22 09:40:21 +0100 |
commit | f60eeee9527a2625a71196293b7de099fd78ffd5 (patch) | |
tree | 8193555db20ee912d3a8311384d873afb1172776 /client | |
parent | 9d4da685021c3a5501ae1f15e314b6a36c2c3438 (diff) | |
download | mariadb-git-f60eeee9527a2625a71196293b7de099fd78ffd5.tar.gz |
MDEV-21062 Do not use popen() in text mode for mysql_upgrade.
Diffstat (limited to 'client')
-rw-r--r-- | client/mysql_upgrade.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 73a9791d593..4e17089593f 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -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) { |