[Groonga-commit] groonga/groonga at ad5cc8e [master] Fix a bug that 1969-12-31 23:59:59 UTC (Unix time: -1) causes an error

Back to archive index

susumu.yata null+****@clear*****
Mon May 12 17:21:23 JST 2014


susumu.yata	2014-05-12 17:21:23 +0900 (Mon, 12 May 2014)

  New Revision: ad5cc8ebeaf0da41c0dd2fed893aaec817922130
  https://github.com/groonga/groonga/commit/ad5cc8ebeaf0da41c0dd2fed893aaec817922130

  Message:
    Fix a bug that 1969-12-31 23:59:59 UTC (Unix time: -1) causes an error
    
    Redmine: fixes #2551

  Modified files:
    lib/ctx.c

  Modified: lib/ctx.c (+5 -2)
===================================================================
--- lib/ctx.c    2014-05-12 11:01:48 +0900 (c523827)
+++ lib/ctx.c    2014-05-12 17:21:23 +0900 (b01bca5)
@@ -1,6 +1,6 @@
 /* -*- c-basic-offset: 2 -*- */
 /*
-  Copyright(C) 2009-2013 Brazil
+  Copyright(C) 2009-2014 Brazil
 
   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
@@ -187,9 +187,12 @@ grn_str2timeval(const char *str, uint32_t str_len, grn_timeval *tv)
     return GRN_INVALID_ARGUMENT;
   }
   r1 = r2;
+  tm.tm_yday = -1;
   tm.tm_isdst = -1;
 
-  if ((tv->tv_sec = mktime(&tm)) == -1) { return GRN_INVALID_ARGUMENT; }
+  /* tm_yday is set appropriately (0-365) on successful completion. */
+  tv->tv_sec = mktime(&tm);
+  if (tm.tm_yday == -1) { return GRN_INVALID_ARGUMENT; }
   if ((r1 + 1) < rend && *r1 == '.') { r1++; }
   uv = grn_atoi(r1, rend, &r2);
   while (r2 < r1 + 6) {
-------------- next part --------------
HTML����������������������������...
下載 



More information about the Groonga-commit mailing list
Back to archive index