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

Side by Side Diff: vm/os_linux.cc

Issue 10696165: Don't allow OS::SNPrint or OS::VSNPrint to return negative values. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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 | « vm/os.h ('k') | vm/os_macos.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/os.h" 5 #include "vm/os.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <limits.h> 8 #include <limits.h>
9 #include <time.h> 9 #include <time.h>
10 #include <sys/resource.h> 10 #include <sys/resource.h>
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 int OS::SNPrint(char* str, size_t size, const char* format, ...) { 146 int OS::SNPrint(char* str, size_t size, const char* format, ...) {
147 va_list args; 147 va_list args;
148 va_start(args, format); 148 va_start(args, format);
149 int retval = VSNPrint(str, size, format, args); 149 int retval = VSNPrint(str, size, format, args);
150 va_end(args); 150 va_end(args);
151 return retval; 151 return retval;
152 } 152 }
153 153
154 154
155 int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) { 155 int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) {
156 return vsnprintf(str, size, format, args); 156 int retval = vsnprintf(str, size, format, args);
157 if (retval < 0) {
158 FATAL1("Fatal error in OS::VSNPrint with format '%s'", format);
159 }
160 return retval;
157 } 161 }
158 162
159 163
160 void OS::PrintErr(const char* format, ...) { 164 void OS::PrintErr(const char* format, ...) {
161 va_list args; 165 va_list args;
162 va_start(args, format); 166 va_start(args, format);
163 VFPrint(stderr, format, args); 167 VFPrint(stderr, format, args);
164 va_end(args); 168 va_end(args);
165 } 169 }
166 170
(...skipping 15 matching lines...) Expand all
182 void OS::Abort() { 186 void OS::Abort() {
183 abort(); 187 abort();
184 } 188 }
185 189
186 190
187 void OS::Exit(int code) { 191 void OS::Exit(int code) {
188 exit(code); 192 exit(code);
189 } 193 }
190 194
191 } // namespace dart 195 } // namespace dart
OLDNEW
« no previous file with comments | « vm/os.h ('k') | vm/os_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698