diff options
author | Dmitry Shulga <Dmitry.Shulga@oracle.com> | 2011-02-05 11:02:00 +0600 |
---|---|---|
committer | Dmitry Shulga <Dmitry.Shulga@oracle.com> | 2011-02-05 11:02:00 +0600 |
commit | 980868eb4e4db550497ba40674b5b64f2e062cd9 (patch) | |
tree | 0081afb284ed8dce0f349971d24915910f875a70 /mysql-test/t/mysql.test | |
parent | 7c8c7c27b5ff72e17b126e8db0c9e40be9673a15 (diff) | |
download | mariadb-git-980868eb4e4db550497ba40674b5b64f2e062cd9.tar.gz |
Fixed bug#57450 - mysql client enter in an infinite loop
if the standard input is a directory.
The problem is that mysql monitor try to read from stdin without
checking input source type.
The solution is to stop reading data from standard input if a call
to read(2) failed.
A new test case was added into mysql.test.
client/my_readline.h:
Data members error and truncated was added to LINE_BUFFER structure.
These data members used instead of out parameters in functions
batch_readline, intern_read_line.
client/mysql.cc:
read_and_execute() was modified: set status.exit_status to 1
when the error occured while reading the next command line in
non-interactive mode. Also the value of the truncated attribute
of structure LINE_BUFF is taken into account only for non-iteractive mode.
client/readline.cc:
intern_read_line() was modified: cancel reading from input if
fill_buffer() returns -1, e.g. if call to read failed.
batch_readline was modified: set the error data member of LINE_BUFFER
structure to value of my_errno when system error happened during call
to my_read/my_realloc.
mysql-test/t/mysql.test:
Test for bug#57450 was added.
Diffstat (limited to 'mysql-test/t/mysql.test')
-rw-r--r-- | mysql-test/t/mysql.test | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index 2dcc77a16c2..aa774036d10 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -412,6 +412,12 @@ drop table t1; --echo --exec $MYSQL --skip-column-names --vertical test -e "select 1 as a" +# +# Bug#57450: mysql client enter in an infinite loop if the standard input is a directory +# +--error 1 +--exec $MYSQL < . + --echo --echo # |