summaryrefslogtreecommitdiff
path: root/libmysql
diff options
context:
space:
mode:
authorunknown <tsmith@ramayana.hindu.god>2007-10-10 14:15:09 -0600
committerunknown <tsmith@ramayana.hindu.god>2007-10-10 14:15:09 -0600
commit17c19299afd94a4f97f2cad0dd71d25299e56206 (patch)
tree0c7021abce949f66539e39f9be638cd713ae31b6 /libmysql
parent03bef972d3b508013cfcad2de294569ecdf16158 (diff)
parent5597f40f7f6edf7eb1f9c8d4b14000e041f68944 (diff)
downloadmariadb-git-17c19299afd94a4f97f2cad0dd71d25299e56206.tar.gz
Merge ramayana.hindu.god:/home/tsmith/m/bk/51
into ramayana.hindu.god:/home/tsmith/m/bk/maint/51 configure.in: Auto merged mysql-test/Makefile.am: Auto merged mysql-test/mysql-test-run.pl: Auto merged scripts/Makefile.am: Auto merged scripts/mysql_system_tables_data.sql: Auto merged scripts/mysqld_safe.sh: Auto merged sql/sql_select.cc: Auto merged storage/innobase/handler/ha_innodb.cc: Auto merged
Diffstat (limited to 'libmysql')
-rw-r--r--libmysql/libmysql.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 74435a1eb57..8ccf7b7d5e2 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -133,10 +133,23 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)),
{
struct servent *serv_ptr;
char *env;
- if ((serv_ptr = getservbyname("mysql", "tcp")))
- mysql_port = (uint) ntohs((ushort) serv_ptr->s_port);
- if ((env = getenv("MYSQL_TCP_PORT")))
- mysql_port =(uint) atoi(env);
+
+ /*
+ if builder specifically requested a default port, use that
+ (even if it coincides with our factory default).
+ only if they didn't do we check /etc/services (and, failing
+ on that, fall back to the factory default of 3306).
+ either default can be overridden by the environment variable
+ MYSQL_TCP_PORT, which in turn can be overridden with command
+ line options.
+ */
+
+#if MYSQL_PORT_DEFAULT == 0
+ if ((serv_ptr = getservbyname("mysql", "tcp")))
+ mysql_port = (uint) ntohs((ushort) serv_ptr->s_port);
+#endif
+ if ((env = getenv("MYSQL_TCP_PORT")))
+ mysql_port =(uint) atoi(env);
}
#endif
}
@@ -4679,7 +4692,7 @@ int cli_read_binary_rows(MYSQL_STMT *stmt)
NET *net;
DBUG_ENTER("cli_read_binary_rows");
-
+
if (!mysql)
{
set_stmt_error(stmt, CR_SERVER_LOST, unknown_sqlstate);