diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result
index 586e345ea10f6faa39beeecd58a1ba2de563a96f..2f40740d4aad983e857e6a6b62091be8223b6108 100644
--- a/mysql-test/r/func_test.result
+++ b/mysql-test/r/func_test.result
@@ -26,6 +26,9 @@
 1	1	1
 -1.49 or -1.49	0.6 or 0.6
 1	1
+start	ctime1	ctime2
+start	ctime1	ctime2
+2002-11-04 00:00:00	20021029165106	20021105164731
 5 between 0 and 10 between 0 and 1	(5 between 0 and 10) between 0 and 1
 0	1
 1 and 2 between 2 and 10	2 between 2 and 10 and 1
diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test
index ec44009b1a66f41d6fe76b7300a6c440000cad49..ccbb531e2e63ec9dd7a99ab32fce852110531f89 100644
--- a/mysql-test/t/func_test.test
+++ b/mysql-test/t/func_test.test
@@ -15,6 +15,16 @@ select 2 between 1 and 3, "monty" between "max" and "my",2=2 and "monty" between
 select 'b' between 'a' and 'c', 'B' between 'a' and 'c';
 select 2 in (3,2,5,9,5,1),"monty" in ("david","monty","allan"), 1.2 in (1.4,1.2,1.0);
 select -1.49 or -1.49,0.6 or 0.6;
+drop table if exists t1,t2;
+CREATE TABLE t1 ( start datetime default NULL) TYPE=MyISAM;
+INSERT INTO t1 VALUES ('2002-10-21 00:00:00');
+INSERT INTO t1 VALUES ('2002-10-28 00:00:00');
+INSERT INTO t1 VALUES ('2002-11-04 00:00:00');
+CREATE TABLE t2 ( ctime1 timestamp(14) NOT NULL, ctime2 timestamp(14) NOT NULL) TYPE=MyISAM;
+INSERT INTO t2 VALUES (20021029165106,20021105164731);
+select * from t1, t2 where t1.start between t2.ctime1 and t2.ctime2;
+select * from t1, t2 where t1.start >= t2.ctime1 and t1.start <= t2.ctime2;
+drop table if exists t1,t2;
 
 #
 # Wrong usage of functions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 71b832f24f41cf2d76632354d9f597fa06c5964f..8d6a1a8a7008d0b50076776c27b2459b6771e3d8 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -3543,7 +3543,6 @@ static void set_options(void)
 #endif
   my_bind_addr = htonl( INADDR_ANY );
 }
-
 	/* Initiates DEBUG - but no debugging here ! */
 
 static void get_options(int argc,char **argv)
@@ -3893,7 +3892,7 @@ static void get_options(int argc,char **argv)
       else
       {
 	struct hostent *ent;
-	if (!optarg || !optarg[0])
+	if (optarg && optarg[0])
 	  ent=gethostbyname(optarg);
 	else
 	{