summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2011-02-09 10:16:32 +0200
committerGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2011-02-09 10:16:32 +0200
commitbc35f8cdf1a98e0a1d97c807b4bb9e11937a92c6 (patch)
tree8c65659e28e9be5449c74b859853fd3c2fa63e5f /sql
parentb169b8d8530208f7655782841fdbe92a1b61f56d (diff)
parentd2495d17961995cf661ff7e1e89738b922fefe93 (diff)
downloadmariadb-git-bc35f8cdf1a98e0a1d97c807b4bb9e11937a92c6.tar.gz
merge 5.0->5.0-security
Diffstat (limited to 'sql')
-rw-r--r--sql/mysqld.cc14
-rw-r--r--sql/set_var.cc12
-rw-r--r--sql/sql_class.h2
3 files changed, 14 insertions, 14 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 5f84d15588d..f026bab1c32 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2836,13 +2836,6 @@ static int init_common_variables(const char *conf_file_name, int argc,
max_system_variables.pseudo_thread_id= (ulong)~0;
server_start_time= flush_status_time= time((time_t*) 0);
- /* TODO: remove this when my_time_t is 64 bit compatible */
- if (server_start_time >= (time_t) MY_TIME_T_MAX)
- {
- sql_print_error("This MySQL server doesn't support dates later then 2038");
- return 1;
- }
-
if (init_thread_environment())
return 1;
mysql_init_variables();
@@ -2882,6 +2875,13 @@ static int init_common_variables(const char *conf_file_name, int argc,
mysql_slow_log.init_pthread_objects();
mysql_bin_log.init_pthread_objects();
+ /* TODO: remove this when my_time_t is 64 bit compatible */
+ if (!IS_TIME_T_VALID_FOR_TIMESTAMP(server_start_time))
+ {
+ sql_print_error("This MySQL server doesn't support dates later then 2038");
+ return 1;
+ }
+
if (gethostname(glob_hostname,sizeof(glob_hostname)) < 0)
{
strmake(glob_hostname, STRING_WITH_LEN("localhost"));
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 9c327504577..fbc7cdbc232 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -2714,14 +2714,14 @@ int set_var_collation_client::update(THD *thd)
bool sys_var_timestamp::check(THD *thd, set_var *var)
{
- time_t val;
+ longlong val;
var->save_result.ulonglong_value= var->value->val_int();
- val= (time_t) var->save_result.ulonglong_value;
- if (val < (time_t) MY_TIME_T_MIN || val > (time_t) MY_TIME_T_MAX)
+ val= (longlong) var->save_result.ulonglong_value;
+ if (val != 0 && // this is how you set the default value
+ (val < TIMESTAMP_MIN_VALUE || val > TIMESTAMP_MAX_VALUE))
{
- my_message(ER_UNKNOWN_ERROR,
- "This version of MySQL doesn't support dates later than 2038",
- MYF(0));
+ char buf[64];
+ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), "timestamp", llstr(val, buf));
return TRUE;
}
return FALSE;
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 2f4af15c02d..70086e2d944 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1710,7 +1710,7 @@ public:
/*TODO: this will be obsolete when we have support for 64 bit my_time_t */
inline bool is_valid_time()
{
- return (start_time < (time_t) MY_TIME_T_MAX);
+ return (IS_TIME_T_VALID_FOR_TIMESTAMP(start_time));
}
inline void insert_id(ulonglong id_arg)
{