Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(518)

Side by Side Diff: src/base/platform/platform-linux.cc

Issue 662093003: Don't crash if the tm_zone field returned by localtime is NULL (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Platform-specific code for Linux goes here. For the POSIX-compatible 5 // Platform-specific code for Linux goes here. For the POSIX-compatible
6 // parts, the implementation is in platform-posix.cc. 6 // parts, the implementation is in platform-posix.cc.
7 7
8 #include <pthread.h> 8 #include <pthread.h>
9 #include <semaphore.h> 9 #include <semaphore.h>
10 #include <signal.h> 10 #include <signal.h>
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 103
104 const char* OS::LocalTimezone(double time, TimezoneCache* cache) { 104 const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
105 #if V8_OS_NACL 105 #if V8_OS_NACL
106 // Missing support for tm_zone field. 106 // Missing support for tm_zone field.
107 return ""; 107 return "";
108 #else 108 #else
109 if (std::isnan(time)) return ""; 109 if (std::isnan(time)) return "";
110 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); 110 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
111 struct tm* t = localtime(&tv); 111 struct tm* t = localtime(&tv);
112 if (NULL == t) return ""; 112 if (!t || !t->tm_zone) return "";
113 return t->tm_zone; 113 return t->tm_zone;
114 #endif 114 #endif
115 } 115 }
116 116
117 117
118 double OS::LocalTimeOffset(TimezoneCache* cache) { 118 double OS::LocalTimeOffset(TimezoneCache* cache) {
119 #if V8_OS_NACL 119 #if V8_OS_NACL
120 // Missing support for tm_zone field. 120 // Missing support for tm_zone field.
121 return 0; 121 return 0;
122 #else 122 #else
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 #endif 437 #endif
438 return munmap(base, size) == 0; 438 return munmap(base, size) == 0;
439 } 439 }
440 440
441 441
442 bool VirtualMemory::HasLazyCommits() { 442 bool VirtualMemory::HasLazyCommits() {
443 return true; 443 return true;
444 } 444 }
445 445
446 } } // namespace v8::base 446 } } // namespace v8::base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698