diff options
author | unknown <jimw@mysql.com> | 2005-01-11 05:10:08 +0100 |
---|---|---|
committer | unknown <jimw@mysql.com> | 2005-01-11 05:10:08 +0100 |
commit | 7b66387475d66db168629dc679e9a95035b1d3ae (patch) | |
tree | efcb9c5ca5983631374c7707ab34e58700a568f4 /sql-common | |
parent | 09ee2d3db0d34d2226d8c743c7f9ab0b9f86a669 (diff) | |
parent | 3c41c5fb1ca733f48fc24c05637084838f0cae55 (diff) | |
download | mariadb-git-7b66387475d66db168629dc679e9a95035b1d3ae.tar.gz |
Merge
BitKeeper/etc/gone:
auto-union
innobase/os/os0file.c:
Auto merged
sql-common/client.c:
Auto merged
sql/examples/ha_archive.cc:
Auto merged
sql/net_serv.cc:
Auto merged
sql/set_var.cc:
Auto merged
Diffstat (limited to 'sql-common')
-rw-r--r-- | sql-common/client.c | 60 |
1 files changed, 38 insertions, 22 deletions
diff --git a/sql-common/client.c b/sql-common/client.c index 9e08e8c0f59..8259849cdbe 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -318,8 +318,9 @@ HANDLE create_named_pipe(NET *net, uint connect_timeout, char **arg_host, { net->last_errno=CR_NAMEDPIPEOPEN_ERROR; strmov(net->sqlstate, unknown_sqlstate); - sprintf(net->last_error,ER(net->last_errno),host, unix_socket, - (ulong) GetLastError()); + my_snprintf(net->last_error, sizeof(net->last_error)-1, + ER(net->last_errno), host, unix_socket, + (ulong) GetLastError()); return INVALID_HANDLE_VALUE; } /* wait for for an other instance */ @@ -327,8 +328,9 @@ HANDLE create_named_pipe(NET *net, uint connect_timeout, char **arg_host, { net->last_errno=CR_NAMEDPIPEWAIT_ERROR; strmov(net->sqlstate, unknown_sqlstate); - sprintf(net->last_error,ER(net->last_errno),host, unix_socket, - (ulong) GetLastError()); + my_snprintf(net->last_error, sizeof(net->last_error)-1, + ER(net->last_errno), host, unix_socket, + (ulong) GetLastError()); return INVALID_HANDLE_VALUE; } } @@ -336,8 +338,9 @@ HANDLE create_named_pipe(NET *net, uint connect_timeout, char **arg_host, { net->last_errno=CR_NAMEDPIPEOPEN_ERROR; strmov(net->sqlstate, unknown_sqlstate); - sprintf(net->last_error,ER(net->last_errno),host, unix_socket, - (ulong) GetLastError()); + my_snprintf(net->last_error, sizeof(net->last_error)-1, + ER(net->last_errno), host, unix_socket, + (ulong) GetLastError()); return INVALID_HANDLE_VALUE; } dwMode = PIPE_READMODE_BYTE | PIPE_WAIT; @@ -346,8 +349,9 @@ HANDLE create_named_pipe(NET *net, uint connect_timeout, char **arg_host, CloseHandle( hPipe ); net->last_errno=CR_NAMEDPIPESETSTATE_ERROR; strmov(net->sqlstate, unknown_sqlstate); - sprintf(net->last_error,ER(net->last_errno),host, unix_socket, - (ulong) GetLastError()); + my_snprintf(net->last_error, sizeof(net->last_error)-1, + ER(net->last_errno),host, unix_socket, + (ulong) GetLastError()); return INVALID_HANDLE_VALUE; } *arg_host=host ; *arg_unix_socket=unix_socket; /* connect arg */ @@ -560,9 +564,11 @@ err: net->last_errno=error_allow; strmov(net->sqlstate, unknown_sqlstate); if (error_allow == CR_SHARED_MEMORY_EVENT_ERROR) - sprintf(net->last_error,ER(net->last_errno),suffix_pos,error_code); + my_snprintf(net->last_error,sizeof(net->last_error)-1, + ER(net->last_errno),suffix_pos,error_code); else - sprintf(net->last_error,ER(net->last_errno),error_code); + my_snprintf(net->last_error,sizeof(net->last_error)-1, + ER(net->last_errno),error_code); return(INVALID_HANDLE_VALUE); } return(handle_map); @@ -792,7 +798,8 @@ static int check_license(MYSQL *mysql) if (net->last_errno == ER_UNKNOWN_SYSTEM_VARIABLE) { net->last_errno= CR_WRONG_LICENSE; - sprintf(net->last_error, ER(net->last_errno), required_license); + my_snprintf(net->last_error, sizeof(net->last_error)-1, + ER(net->last_errno), required_license); } return 1; } @@ -809,7 +816,8 @@ static int check_license(MYSQL *mysql) strncmp(row[0], required_license, sizeof(required_license)))) { net->last_errno= CR_WRONG_LICENSE; - sprintf(net->last_error, ER(net->last_errno), required_license); + my_snprintf(net->last_error, sizeof(net->last_error)-1, + ER(net->last_errno), required_license); } mysql_free_result(res); return net->last_errno; @@ -1647,7 +1655,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, sock=0; unix_socket = 0; host=mysql->options.shared_memory_base_name; - sprintf(host_info=buff, ER(CR_SHARED_MEMORY_CONNECTION), host); + my_snprintf(host_info=buff, sizeof(buff)-1, + ER(CR_SHARED_MEMORY_CONNECTION), host); } } #endif /* HAVE_SMEM */ @@ -1667,7 +1676,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, { net->last_errno=CR_SOCKET_CREATE_ERROR; strmov(net->sqlstate, unknown_sqlstate); - sprintf(net->last_error,ER(net->last_errno),socket_errno); + my_snprintf(net->last_error,sizeof(net->last_error)-1, + ER(net->last_errno),socket_errno); goto error; } net->vio = vio_new(sock, VIO_TYPE_SOCKET, TRUE); @@ -1681,7 +1691,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, socket_errno)); net->last_errno=CR_CONNECTION_ERROR; strmov(net->sqlstate, unknown_sqlstate); - sprintf(net->last_error,ER(net->last_errno),unix_socket,socket_errno); + my_snprintf(net->last_error,sizeof(net->last_error)-1, + ER(net->last_errno),unix_socket,socket_errno); goto error; } mysql->options.protocol=MYSQL_PROTOCOL_SOCKET; @@ -1711,7 +1722,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, else { net->vio=vio_new_win32pipe(hPipe); - sprintf(host_info=buff, ER(CR_NAMEDPIPE_CONNECTION), unix_socket); + my_snprintf(host_info=buff, sizeof(buff)-1, + ER(CR_NAMEDPIPE_CONNECTION), unix_socket); } } #endif @@ -1724,7 +1736,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, port=mysql_port; if (!host) host=LOCAL_HOST; - sprintf(host_info=buff,ER(CR_TCP_CONNECTION),host); + my_snprintf(host_info=buff,sizeof(buff)-1,ER(CR_TCP_CONNECTION),host); DBUG_PRINT("info",("Server name: '%s'. TCP sock: %d", host,port)); #ifdef MYSQL_SERVER thr_alarm_init(&alarmed); @@ -1739,7 +1751,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, { net->last_errno=CR_IPSOCK_ERROR; strmov(net->sqlstate, unknown_sqlstate); - sprintf(net->last_error,ER(net->last_errno),socket_errno); + my_snprintf(net->last_error,sizeof(net->last_error)-1, + ER(net->last_errno),socket_errno); goto error; } net->vio = vio_new(sock,VIO_TYPE_TCPIP,FALSE); @@ -1766,7 +1779,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, my_gethostbyname_r_free(); net->last_errno=CR_UNKNOWN_HOST; strmov(net->sqlstate, unknown_sqlstate); - sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, tmp_errno); + my_snprintf(net->last_error, sizeof(net->last_error)-1, + ER(CR_UNKNOWN_HOST), host, tmp_errno); goto error; } memcpy(&sock_addr.sin_addr, hp->h_addr, @@ -1781,7 +1795,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, host)); net->last_errno= CR_CONN_HOST_ERROR; strmov(net->sqlstate, unknown_sqlstate); - sprintf(net->last_error ,ER(CR_CONN_HOST_ERROR), host, socket_errno); + my_snprintf(net->last_error, sizeof(net->last_error)-1, + ER(CR_CONN_HOST_ERROR), host, socket_errno); goto error; } } @@ -1834,8 +1849,9 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, { strmov(net->sqlstate, unknown_sqlstate); net->last_errno= CR_VERSION_ERROR; - sprintf(net->last_error, ER(CR_VERSION_ERROR), mysql->protocol_version, - PROTOCOL_VERSION); + my_snprintf(net->last_error, sizeof(net->last_error)-1, + ER(CR_VERSION_ERROR), mysql->protocol_version, + PROTOCOL_VERSION); goto error; } end=strend((char*) net->read_pos+1); |