summaryrefslogtreecommitdiff
path: root/libmysql
diff options
context:
space:
mode:
authorunknown <msvensson@pilot.(none)>2007-09-27 08:49:23 +0200
committerunknown <msvensson@pilot.(none)>2007-09-27 08:49:23 +0200
commita1847dc81491d0f4e7bddb603e722c736df4f576 (patch)
tree28d2f4ca6c05befb654ea30f9548ff44229edc5f /libmysql
parent01b69358e32e1dadba158f4b909ab2ed6a26c5e4 (diff)
parentcef45d829203c1f7684efc2f39b41dc3d7b09941 (diff)
downloadmariadb-git-a1847dc81491d0f4e7bddb603e722c736df4f576.tar.gz
Merge bk-internal:/home/bk/mysql-5.0-maint
into pilot.(none):/data/msvensson/mysql/mysql-5.0-maint libmysql/libmysql.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 14b1a682b49..a3919974a97 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
}