Commit 50456f81 authored by unknown's avatar unknown

Merge bk-internal.mysql.com:/data0/bk/mysql-5.0

into  bk-internal.mysql.com:/data0/bk/mysql-5.0-cmake

parents 73ca6fc5 9c9a27d9
......@@ -2354,7 +2354,12 @@ print_table_data(MYSQL_RES *result)
(void) tee_fputs("|", PAGER);
for (uint off=0; (field = mysql_fetch_field(result)) ; off++)
{
tee_fprintf(PAGER, " %-*s |",(int) min(field->max_length,
uint name_length= (uint) strlen(field->name);
uint numcells= charset_info->cset->numcells(charset_info,
field->name,
field->name + name_length);
uint display_length= field->max_length + name_length - numcells;
tee_fprintf(PAGER, " %-*s |",(int) min(display_length,
MAX_COLUMN_LENGTH),
field->name);
num_flag[off]= IS_NUM(field->type);
......
......@@ -850,7 +850,7 @@ static int get_options(int *argc, char ***argv)
static void DB_error(MYSQL *mysql, const char *when)
{
DBUG_ENTER("DB_error");
my_printf_error(0,"Got error: %d: %s %s", MYF(0),
fprintf(stderr, "%s: Got error: %d: %s %s\n", my_progname,
mysql_errno(mysql), mysql_error(mysql), when);
safe_exit(EX_MYSQLERR);
DBUG_VOID_RETURN;
......@@ -879,8 +879,9 @@ static int mysql_query_with_error_report(MYSQL *mysql_con, MYSQL_RES **res,
if (mysql_query(mysql_con, query) ||
(res && !((*res)= mysql_store_result(mysql_con))))
{
my_printf_error(0, "Couldn't execute '%s': %s (%d)", MYF(0),
query, mysql_error(mysql_con), mysql_errno(mysql_con));
fprintf(stderr, "%s: Couldn't execute '%s': %s (%d)\n",
my_progname, query,
mysql_error(mysql_con), mysql_errno(mysql_con));
safe_exit(EX_MYSQLERR);
return 1;
}
......@@ -2234,7 +2235,10 @@ static void dump_table(char *table, char *db)
check_io(md_result_file);
}
if (mysql_query_with_error_report(mysql, 0, query))
{
DB_error(mysql, "when retrieving data from server");
goto err;
}
if (quick)
res=mysql_use_result(mysql);
else
......
......@@ -30,7 +30,7 @@ sub generate_prefix($$)
next;
}
if ( /^\s*[a-zA-Z0-9*_ ]+\s+([_a-zA-Z0-9]+)\s*\(/ )
if ( /^\s*[a-zA-Z0-9*_ ]+\s+\*?([_a-zA-Z0-9]+)\s*\(/ )
{
print OUT "#define $1 ya$1\n";
}
......
#define Copyright yaCopyright
#define yaSSL_CleanUp yayaSSL_CleanUp
#define BN_bin2bn yaBN_bin2bn
#define DH_new yaDH_new
#define DH_free yaDH_free
#define RSA_free yaRSA_free
......@@ -92,6 +93,12 @@
#define SSL_want_read yaSSL_want_read
#define SSL_want_write yaSSL_want_write
#define SSL_pending yaSSL_pending
#define SSLv3_method yaSSLv3_method
#define SSLv3_server_method yaSSLv3_server_method
#define SSLv3_client_method yaSSLv3_client_method
#define TLSv1_server_method yaTLSv1_server_method
#define TLSv1_client_method yaTLSv1_client_method
#define SSLv23_server_method yaSSLv23_server_method
#define SSL_CTX_use_certificate_file yaSSL_CTX_use_certificate_file
#define SSL_CTX_use_PrivateKey_file yaSSL_CTX_use_PrivateKey_file
#define SSL_CTX_set_cipher_list yaSSL_CTX_set_cipher_list
......@@ -115,11 +122,13 @@
#define RAND_write_file yaRAND_write_file
#define RAND_load_file yaRAND_load_file
#define RAND_status yaRAND_status
#define RAND_bytes yaRAND_bytes
#define DES_set_key yaDES_set_key
#define DES_set_odd_parity yaDES_set_odd_parity
#define DES_ecb_encrypt yaDES_ecb_encrypt
#define SSL_CTX_set_default_passwd_cb_userdata yaSSL_CTX_set_default_passwd_cb_userdata
#define SSL_SESSION_free yaSSL_SESSION_free
#define SSL_peek yaSSL_peek
#define SSL_get_certificate yaSSL_get_certificate
#define SSL_get_privatekey yaSSL_get_privatekey
#define X509_get_pubkey yaX509_get_pubkey
......@@ -150,4 +159,3 @@
#define MD5_Init yaMD5_Init
#define MD5_Update yaMD5_Update
#define MD5_Final yaMD5_Final
#define SSL_peek yaSSL_peek
......@@ -29,7 +29,7 @@
#include "runtime.hpp"
#include "misc.hpp"
#if !defined(YASSL_MYSQL_COMPATIBLE)
extern "C" {
// for libcurl configure test, these are the signatures they use
......@@ -37,6 +37,7 @@ extern "C" {
char CRYPTO_lock() { return 0;}
char CRYPTO_add_lock() { return 0;}
} // extern "C"
#endif
#ifdef YASSL_PURE_C
......
......@@ -248,3 +248,14 @@ select rpad(c1,3,'
rpad(c1,3,'') rpad('',3,c1)
drop table t1;
set names koi8r;
create table t1(a char character set cp1251 default _koi8r 0xFF);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(1) character set cp1251 default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1(a char character set latin1 default _cp1251 0xFF);
ERROR 42000: Invalid default value for 'a'
End of 4.1 tests
......@@ -924,6 +924,37 @@ NULL
select ifnull(NULL, _utf8'string');
ifnull(NULL, _utf8'string')
string
set names utf8;
create table t1 (s1 char(5) character set utf8 collate utf8_lithuanian_ci);
insert into t1 values ('I'),('K'),('Y');
select * from t1 where s1 < 'K' and s1 = 'Y';
s1
I
Y
select * from t1 where 'K' > s1 and s1 = 'Y';
s1
I
Y
drop table t1;
create table t1 (s1 char(5) character set utf8 collate utf8_czech_ci);
insert into t1 values ('c'),('d'),('h'),('ch'),('CH'),('cH'),('Ch'),('i');
select * from t1 where s1 > 'd' and s1 = 'CH';
s1
ch
CH
Ch
select * from t1 where 'd' < s1 and s1 = 'CH';
s1
ch
CH
Ch
select * from t1 where s1 = 'cH' and s1 <> 'ch';
s1
cH
select * from t1 where 'cH' = s1 and s1 <> 'ch';
s1
cH
drop table t1;
create table t1 (a varchar(255)) default character set utf8;
insert into t1 values (1.0);
drop table t1;
......
......@@ -294,3 +294,4 @@ DROP TABLE t1;
CREATE TABLE t1 (a INT, UNIQUE USING BTREE(a)) ENGINE=MEMORY;
INSERT INTO t1 VALUES(NULL),(NULL);
DROP TABLE t1;
End of 5.0 tests
This diff is collapsed.
......@@ -187,4 +187,16 @@ select rpad(c1,3,'
#select case c1 when '' then '' when '' then '' else 'c' end from t1;
#select export_set(5,c1,''), export_set(5,'',c1) from t1;
drop table t1;
# End of 4.1 tests
#
# Bug 20695: problem with field default value's character set
#
set names koi8r;
create table t1(a char character set cp1251 default _koi8r 0xFF);
show create table t1;
drop table t1;
--error 1067
create table t1(a char character set latin1 default _cp1251 0xFF);
--echo End of 4.1 tests
......@@ -727,6 +727,24 @@ drop table t1;
select repeat(_utf8'+',3) as h union select NULL;
select ifnull(NULL, _utf8'string');
#
# Bug#9509 Optimizer: wrong result after AND with comparisons
#
set names utf8;
create table t1 (s1 char(5) character set utf8 collate utf8_lithuanian_ci);
insert into t1 values ('I'),('K'),('Y');
select * from t1 where s1 < 'K' and s1 = 'Y';
select * from t1 where 'K' > s1 and s1 = 'Y';
drop table t1;
create table t1 (s1 char(5) character set utf8 collate utf8_czech_ci);
insert into t1 values ('c'),('d'),('h'),('ch'),('CH'),('cH'),('Ch'),('i');
select * from t1 where s1 > 'd' and s1 = 'CH';
select * from t1 where 'd' < s1 and s1 = 'CH';
select * from t1 where s1 = 'cH' and s1 <> 'ch';
select * from t1 where 'cH' = s1 and s1 <> 'ch';
drop table t1;
#
# Bug#10714: Inserting double value into utf8 column crashes server
#
......
......@@ -204,3 +204,4 @@ CREATE TABLE t1 (a INT, UNIQUE USING BTREE(a)) ENGINE=MEMORY;
INSERT INTO t1 VALUES(NULL),(NULL);
DROP TABLE t1;
--echo End of 5.0 tests
......@@ -548,71 +548,6 @@ INSERT INTO t1 VALUES (1),(2),(3);
--exec $MYSQL_DUMP --add-drop-database --skip-comments --databases test
DROP TABLE t1;
#
# Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
#
create database db1;
use db1;
CREATE TABLE t2 (
a varchar(30) default NULL,
KEY a (a(5))
);
INSERT INTO t2 VALUES ('alfred');
INSERT INTO t2 VALUES ('angie');
INSERT INTO t2 VALUES ('bingo');
INSERT INTO t2 VALUES ('waffle');
INSERT INTO t2 VALUES ('lemon');
create view v2 as select * from t2 where a like 'a%' with check option;
--exec $MYSQL_DUMP --skip-comments db1
drop table t2;
drop view v2;
drop database db1;
#
# Bug 10713 mysqldump includes database in create view and referenced tables
#
# create table and views in db2
create database db2;
use db2;
create table t1 (a int);
create table t2 (a int, b varchar(10), primary key(a));
insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg");
insert into t1 values (289), (298), (234), (456), (789);
create view v1 as select * from t2;
create view v2 as select * from t1;
# dump tables and view from db2
--exec $MYSQL_DUMP db2 > $MYSQLTEST_VARDIR/tmp/bug10713.sql
# drop the db, tables and views
drop table t1, t2;
drop view v1, v2;
drop database db2;
# create db1 and reload dump
create database db1;
use db1;
--exec $MYSQL db1 < $MYSQLTEST_VARDIR/tmp/bug10713.sql
# check that all tables and views could be created
show tables;
select * from t2 order by a;
drop table t1, t2;
drop database db1;
#
# BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence
#
--exec $MYSQL_MY_PRINT_DEFAULTS --config-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump
#
# Bug #9558 mysqldump --no-data db t1 t2 format still dumps data
#
......@@ -719,6 +654,12 @@ select * from t1;
drop table t1;
#
# BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence
#
--exec $MYSQL_MY_PRINT_DEFAULTS --config-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump
#
# BUG #19025 mysqldump doesn't correctly dump "auto_increment = [int]"
#
......@@ -748,8 +689,87 @@ show create table `t1`;
drop table `t1`;
#
# Bug #18536: wrong table order
#
create table t1(a int);
create table t2(a int);
create table t3(a int);
--error 6
--exec $MYSQL_DUMP --skip-comments --force --no-data test t3 t1 non_existing t2
drop table t1, t2, t3;
#
# Bug #21288: mysqldump segmentation fault when using --where
#
create table t1 (a int);
--error 2
--exec $MYSQL_DUMP --skip-comments --force test t1 --where='xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 2>&1
drop table t1;
--echo End of 4.1 tests
#
# Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
#
create database db1;
use db1;
CREATE TABLE t2 (
a varchar(30) default NULL,
KEY a (a(5))
);
INSERT INTO t2 VALUES ('alfred');
INSERT INTO t2 VALUES ('angie');
INSERT INTO t2 VALUES ('bingo');
INSERT INTO t2 VALUES ('waffle');
INSERT INTO t2 VALUES ('lemon');
create view v2 as select * from t2 where a like 'a%' with check option;
--exec $MYSQL_DUMP --skip-comments db1
drop table t2;
drop view v2;
drop database db1;
use test;
#
# Bug 10713 mysqldump includes database in create view and referenced tables
#
# create table and views in db2
create database db2;
use db2;
create table t1 (a int);
create table t2 (a int, b varchar(10), primary key(a));
insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg");
insert into t1 values (289), (298), (234), (456), (789);
create view v1 as select * from t2;
create view v2 as select * from t1;
# dump tables and view from db2
--exec $MYSQL_DUMP db2 > $MYSQLTEST_VARDIR/tmp/bug10713.sql
# drop the db, tables and views
drop table t1, t2;
drop view v1, v2;
drop database db2;
use test;
# create db1 and reload dump
create database db1;
use db1;
--exec $MYSQL db1 < $MYSQLTEST_VARDIR/tmp/bug10713.sql
# check that all tables and views could be created
show tables;
select * from t2 order by a;
drop table t1, t2;
drop database db1;
use test;
#
# dump of view
#
......@@ -813,6 +833,7 @@ select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1;
drop view v1, v2, v3;
drop table t1;
#
# Test for dumping triggers
#
......@@ -1072,19 +1093,6 @@ insert into t1 values ('','');
--exec $MYSQL_DUMP --skip-comments --hex-blob test t1
drop table t1;
#
# Bug #18536: wrong table order
#
create table t1(a int);
create table t2(a int);
create table t3(a int);
--error 6
--exec $MYSQL_DUMP --skip-comments --force --no-data test t3 t1 non_existing t2
drop table t1, t2, t3;
--echo End of 4.1 tests
#
# Bug 14871 Invalid view dump output
#
......@@ -1266,11 +1274,11 @@ use mysqldump_dbb;
drop view v1;
drop table t1;
drop database mysqldump_dbb;
use test;
#
# Bug#21215 mysqldump creating incomplete backups without warning
#
use test;
# Create user without sufficient privs to perform the requested operation
create user mysqltest_1@localhost;
......@@ -1339,3 +1347,6 @@ drop table t1;
revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
drop user myDB_User;
drop database mysqldump_myDB;
use test;
--echo End of 5.0 tests
......@@ -36,23 +36,26 @@
uint my_read(File Filedes, byte *Buffer, uint Count, myf MyFlags)
{
uint readbytes,save_count;
uint readbytes, save_count;
DBUG_ENTER("my_read");
DBUG_PRINT("my",("Fd: %d Buffer: 0x%lx Count: %u MyFlags: %d",
Filedes, Buffer, Count, MyFlags));
save_count=Count;
save_count= Count;
for (;;)
{
errno=0; /* Linux doesn't reset this */
if ((readbytes = (uint) read(Filedes, Buffer, Count)) != Count)
errno= 0; /* Linux doesn't reset this */
if ((readbytes= (uint) read(Filedes, Buffer, Count)) != Count)
{
my_errno=errno ? errno : -1;
my_errno= errno ? errno : -1;
DBUG_PRINT("warning",("Read only %ld bytes off %ld from %d, errno: %d",
readbytes,Count,Filedes,my_errno));
readbytes, Count, Filedes, my_errno));
#ifdef THREAD
if (readbytes == 0 && errno == EINTR)
if ((int) readbytes <= 0 && errno == EINTR)
{
DBUG_PRINT("debug", ("my_read() was interrupted and returned %d", (int) readbytes));
continue; /* Interrupted */
}
#endif
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
{
......@@ -68,16 +71,16 @@ uint my_read(File Filedes, byte *Buffer, uint Count, myf MyFlags)
DBUG_RETURN(MY_FILE_ERROR); /* Return with error */
if (readbytes > 0 && (MyFlags & MY_FULL_IO))
{
Buffer+=readbytes;
Count-=readbytes;
Buffer+= readbytes;
Count-= readbytes;
continue;
}
}
if (MyFlags & (MY_NABP | MY_FNABP))
readbytes=0; /* Ok on read */
readbytes= 0; /* Ok on read */
else if (MyFlags & MY_FULL_IO)
readbytes=save_count;
readbytes= save_count;
break;
}
DBUG_RETURN(readbytes);
......
......@@ -860,7 +860,7 @@ my_real_read(NET *net, ulong *complen)
#endif /* EXTRA_DEBUG */
}
#if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER)
if (vio_should_retry(net->vio))
if (vio_errno(net->vio) == SOCKET_EINTR)
{
DBUG_PRINT("warning",("Interrupted read. Retrying..."));
continue;
......
......@@ -870,8 +870,8 @@ struct show_var_st init_vars[]= {
{"have_geometry", (char*) &have_geometry, SHOW_HAVE},
{"have_innodb", (char*) &have_innodb, SHOW_HAVE},
{"have_isam", (char*) &have_isam, SHOW_HAVE},
{"have_ndbcluster", (char*) &have_ndbcluster, SHOW_HAVE},
{"have_merge_engine", (char*) &have_merge_db, SHOW_HAVE},
{"have_ndbcluster", (char*) &have_ndbcluster, SHOW_HAVE},
{"have_openssl", (char*) &have_openssl, SHOW_HAVE},
{"have_query_cache", (char*) &have_query_cache, SHOW_HAVE},
{"have_raid", (char*) &have_raid, SHOW_HAVE},
......
......@@ -654,7 +654,8 @@ int MYSQLlex(void *arg, void *yythd)
*/
if ((yylval->lex_str.str[0]=='_') &&
(lex->charset=get_charset_by_csname(yylval->lex_str.str+1,
(lex->underscore_charset=
get_charset_by_csname(yylval->lex_str.str + 1,
MY_CS_PRIMARY,MYF(0))))
return(UNDERSCORE_CHARSET);
return(result_state); // IDENT or IDENT_QUOTED
......
......@@ -834,7 +834,7 @@ typedef struct st_lex : public Query_tables_list
XID *xid;
gptr yacc_yyss,yacc_yyvs;
THD *thd;
CHARSET_INFO *charset;
CHARSET_INFO *charset, *underscore_charset;
/* store original leaf_tables for INSERT SELECT and PS/SP */
TABLE_LIST *leaf_tables_insert;
/* Position (first character index) of SELECT of CREATE VIEW statement */
......
......@@ -7210,6 +7210,8 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
left_item->collation.collation == value->collation.collation))
{
Item *tmp=value->new_item();
tmp->collation.set(right_item->collation);
if (tmp)
{
thd->change_item_tree(args + 1, tmp);
......@@ -7232,6 +7234,8 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
right_item->collation.collation == value->collation.collation))
{
Item *tmp=value->new_item();
tmp->collation.set(left_item->collation);
if (tmp)
{
thd->change_item_tree(args, tmp);
......
......@@ -715,6 +715,40 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
DBUG_RETURN(-1);
}
/*
Convert the default value from client character
set into the column character set if necessary.
*/
if (sql_field->def &&
save_cs != sql_field->def->collation.collation &&
(sql_field->sql_type == FIELD_TYPE_VAR_STRING ||
sql_field->sql_type == FIELD_TYPE_STRING ||
sql_field->sql_type == FIELD_TYPE_SET ||
sql_field->sql_type == FIELD_TYPE_ENUM))
{
Query_arena backup_arena;
bool need_to_change_arena= !thd->stmt_arena->is_conventional();
if (need_to_change_arena)
{
/* Asser that we don't do that at every PS execute */
DBUG_ASSERT(thd->stmt_arena->is_first_stmt_execute() ||
thd->stmt_arena->is_first_sp_execute());
thd->set_n_backup_active_arena(thd->stmt_arena, &backup_arena);
}
sql_field->def= sql_field->def->safe_charset_converter(save_cs);
if (need_to_change_arena)
thd->restore_active_arena(thd->stmt_arena, &backup_arena);
if (sql_field->def == NULL)
{
/* Could not convert */
my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name);
DBUG_RETURN(-1);
}
}
if (sql_field->sql_type == FIELD_TYPE_SET ||
sql_field->sql_type == FIELD_TYPE_ENUM)
{
......@@ -776,35 +810,6 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
sql_field->interval_list.empty(); // Don't need interval_list anymore
}
/*
Convert the default value from client character
set into the column character set if necessary.
*/
if (sql_field->def && cs != sql_field->def->collation.collation)
{
Query_arena backup_arena;
bool need_to_change_arena= !thd->stmt_arena->is_conventional();
if (need_to_change_arena)
{
/* Asser that we don't do that at every PS execute */
DBUG_ASSERT(thd->stmt_arena->is_first_stmt_execute() ||
thd->stmt_arena->is_first_sp_execute());
thd->set_n_backup_active_arena(thd->stmt_arena, &backup_arena);
}
sql_field->def= sql_field->def->safe_charset_converter(cs);
if (need_to_change_arena)
thd->restore_active_arena(thd->stmt_arena, &backup_arena);
if (sql_field->def == NULL)
{
/* Could not convert */
my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name);
DBUG_RETURN(-1);
}
}
if (sql_field->sql_type == FIELD_TYPE_SET)
{
uint32 field_length;
......
......@@ -7069,7 +7069,7 @@ text_literal:
| NCHAR_STRING
{ $$= new Item_string($1.str,$1.length,national_charset_info); }
| UNDERSCORE_CHARSET TEXT_STRING
{ $$ = new Item_string($2.str,$2.length,Lex->charset); }
{ $$ = new Item_string($2.str,$2.length,Lex->underscore_charset); }
| text_literal TEXT_STRING_literal
{ ((Item_string*) $1)->append($2.str,$2.length); }
;
......@@ -7147,7 +7147,7 @@ literal:
(String*) 0;
$$= new Item_string(str ? str->ptr() : "",
str ? str->length() : 0,
Lex->charset);
Lex->underscore_charset);
}
| UNDERSCORE_CHARSET BIN_NUM
{
......
......@@ -10444,8 +10444,9 @@ static void test_ps_i18n()
const char *stmt_text;
MYSQL_BIND bind_array[2];
const char *koi8= ", ";
const char *cp1251= ", ";
/* Represented as numbers to keep UTF8 tools from clobbering them. */
const char *koi8= "\xee\xd5\x2c\x20\xda\xc1\x20\xd2\xd9\xc2\xc1\xcc\xcb\xd5";
const char *cp1251= "\xcd\xf3\x2c\x20\xe7\xe0\x20\xf0\xfb\xe1\xe0\xeb\xea\xf3";
char buf1[16], buf2[16];
ulong buf1_len, buf2_len;
......
......@@ -379,16 +379,30 @@ my_bool vio_poll_read(Vio *vio,uint timeout)
}
void vio_timeout(Vio *vio __attribute__((unused)),
uint which __attribute__((unused)),
uint timeout __attribute__((unused)))
void vio_timeout(Vio *vio, uint which, uint timeout)
{
/* TODO: some action should be taken if socket timeouts are not supported. */
#if defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO)
#ifdef __WIN__
ulong wait_timeout= (ulong) timeout * 1000;
(void) setsockopt(vio->sd, SOL_SOCKET,
which ? SO_SNDTIMEO : SO_RCVTIMEO, (char*) &wait_timeout,
sizeof(wait_timeout));
#endif /* __WIN__ */
/* Windows expects time in milliseconds as int. */
int wait_timeout= (int) timeout * 1000;
#else /* ! __WIN__ */
/* POSIX specifies time as struct timeval. */
struct timeval wait_timeout;
wait_timeout.tv_sec= timeout;
wait_timeout.tv_usec= 0;
#endif /* ! __WIN__ */
/* TODO: return value should be checked. */
(void) setsockopt(vio->sd, SOL_SOCKET, which ? SO_SNDTIMEO : SO_RCVTIMEO,
(char*) &wait_timeout, sizeof(wait_timeout));
#endif /* defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO) */
}
......
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