summaryrefslogtreecommitdiff
path: root/libmysql
diff options
context:
space:
mode:
authorunknown <tnurnberg@sin.intern.azundris.com>2007-09-15 04:45:20 +0200
committerunknown <tnurnberg@sin.intern.azundris.com>2007-09-15 04:45:20 +0200
commit613f7ff3b5f887a8ef0218cb932df609858a0171 (patch)
tree28572ba8a4ea5db35b3b2971f18422597f5a6511 /libmysql
parentb371ee8a40c83cf75203fc6dc1a76280c3eed566 (diff)
parentee7f125d5f42fd653cb09cf5b15ae9384b7d9248 (diff)
downloadmariadb-git-613f7ff3b5f887a8ef0218cb932df609858a0171.tar.gz
Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into mysql.com:/home/tnurnberg/15327/50-15327 client/mysql.cc: Auto merged client/mysql_upgrade.c: Auto merged client/mysqldump.c: Auto merged client/mysqltest.c: Auto merged configure.in: Auto merged libmysql/libmysql.c: Auto merged mysql-test/Makefile.am: Auto merged scripts/Makefile.am: Auto merged sql/mysqld.cc: Auto merged tests/mysql_client_test.c: Auto merged
Diffstat (limited to 'libmysql')
-rw-r--r--libmysql/libmysql.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 85c56a7ea40..fc20296e6cb 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
}