Commit e4bec46e authored by unknown's avatar unknown

Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0

into  neptunus.(none):/home/msvensson/mysql/mysql-5.1

parents da7087dd c351b5bf
...@@ -349,7 +349,7 @@ Warnings: ...@@ -349,7 +349,7 @@ Warnings:
Warning 1265 Data truncated for column 'Alter_routine_priv' at row 1 Warning 1265 Data truncated for column 'Alter_routine_priv' at row 1
FLUSH PRIVILEGES; FLUSH PRIVILEGES;
create database TEStdb; create database TEStdb;
ERROR 42000: Access denied for user 'mysqltest_1'@'%' to database 'TEStdb' Got one of the listed errors
delete from mysql.user; delete from mysql.user;
delete from mysql.db where host='%' and user='mysqltest_1' and db='TESTDB'; delete from mysql.db where host='%' and user='mysqltest_1' and db='TESTDB';
insert into mysql.user select * from t1; insert into mysql.user select * from t1;
......
...@@ -452,7 +452,8 @@ connect (con1,localhost,mysqltest_1,password,TESTDB); ...@@ -452,7 +452,8 @@ connect (con1,localhost,mysqltest_1,password,TESTDB);
# The user mysqltest_1 should only be allowed access to # The user mysqltest_1 should only be allowed access to
# database TESTDB, not TEStdb # database TESTDB, not TEStdb
--error 1044 # On system with "lowercase names" we get error "1007: Can't create db..."
--error 1044, 1007
create database TEStdb; create database TEStdb;
# Clean-up # Clean-up
......
...@@ -208,23 +208,40 @@ my_bool net_realloc(NET *net, ulong length) ...@@ -208,23 +208,40 @@ my_bool net_realloc(NET *net, ulong length)
RETURN VALUES RETURN VALUES
0 No data to read 0 No data to read
1 Data or EOF to read 1 Data or EOF to read
-1 Don't know if data is ready or not
*/ */
static my_bool net_data_is_ready(my_socket sd) static int net_data_is_ready(my_socket sd)
{ {
#ifdef HAVE_POLL
struct pollfd ufds;
int res;
ufds.fd= sd;
ufds.events= POLLIN | POLLPRI;
if (!(res= poll(&ufds, 1, 0)))
return 0;
if (res < 0 || !(ufds.revents & (POLLIN | POLLPRI)))
return 0;
return 1;
#else
fd_set sfds; fd_set sfds;
struct timeval tv; struct timeval tv;
int res; int res;
if (sd >= FD_SETSIZE)
return -1;
FD_ZERO(&sfds); FD_ZERO(&sfds);
FD_SET(sd, &sfds); FD_SET(sd, &sfds);
tv.tv_sec= tv.tv_usec= 0; tv.tv_sec= tv.tv_usec= 0;
if ((res= select(sd+1, &sfds, NULL, NULL, &tv)) < 0) if ((res= select(sd+1, &sfds, NULL, NULL, &tv)) < 0)
return FALSE; return 0;
else else
return test(res ? FD_ISSET(sd, &sfds) : 0); return test(res ? FD_ISSET(sd, &sfds) : 0);
#endif
} }
...@@ -251,10 +268,10 @@ static my_bool net_data_is_ready(my_socket sd) ...@@ -251,10 +268,10 @@ static my_bool net_data_is_ready(my_socket sd)
void net_clear(NET *net) void net_clear(NET *net)
{ {
int count; int count, ready;
DBUG_ENTER("net_clear"); DBUG_ENTER("net_clear");
#if !defined(EMBEDDED_LIBRARY) #if !defined(EMBEDDED_LIBRARY)
while(net_data_is_ready(net->vio->sd)) while((ready= net_data_is_ready(net->vio->sd)) != 0)
{ {
/* The socket is ready */ /* The socket is ready */
if ((count= vio_read(net->vio, (char*) (net->buff), if ((count= vio_read(net->vio, (char*) (net->buff),
...@@ -269,6 +286,10 @@ void net_clear(NET *net) ...@@ -269,6 +286,10 @@ void net_clear(NET *net)
} }
else else
{ {
/* No data to read and 'net_data_is_ready' returned "don't know" */
if (ready == -1)
break;
DBUG_PRINT("info",("socket ready but only EOF to read - disconnected")); DBUG_PRINT("info",("socket ready but only EOF to read - disconnected"));
net->error= 2; net->error= 2;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment