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

Side by Side Diff: runtime/bin/file_macos.cc

Issue 22634003: Replaced strerror() calls with threadsafe strerror_r() (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 | « runtime/bin/file_linux.cc ('k') | runtime/bin/process_android.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 "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_MACOS) 6 #if defined(TARGET_OS_MACOS)
7 7
8 #include "bin/file.h" 8 #include "bin/file.h"
9 9
10 #include <errno.h> // NOLINT 10 #include <errno.h> // NOLINT
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 const char* File::StringEscapedPathSeparator() { 312 const char* File::StringEscapedPathSeparator() {
313 return "/"; 313 return "/";
314 } 314 }
315 315
316 316
317 File::StdioHandleType File::GetStdioHandleType(int fd) { 317 File::StdioHandleType File::GetStdioHandleType(int fd) {
318 ASSERT(0 <= fd && fd <= 2); 318 ASSERT(0 <= fd && fd <= 2);
319 struct stat buf; 319 struct stat buf;
320 int result = fstat(fd, &buf); 320 int result = fstat(fd, &buf);
321 if (result == -1) { 321 if (result == -1) {
322 FATAL2("Failed stat on file descriptor %d: %s", fd, strerror(errno)); 322 const int kBufferSize = 1024;
323 char error_message[kBufferSize];
324 strerror_r(errno, error_message, kBufferSize);
325 FATAL2("Failed stat on file descriptor %d: %s", fd, error_message);
323 } 326 }
324 if (S_ISCHR(buf.st_mode)) return kTerminal; 327 if (S_ISCHR(buf.st_mode)) return kTerminal;
325 if (S_ISFIFO(buf.st_mode)) return kPipe; 328 if (S_ISFIFO(buf.st_mode)) return kPipe;
326 if (S_ISSOCK(buf.st_mode)) return kSocket; 329 if (S_ISSOCK(buf.st_mode)) return kSocket;
327 if (S_ISREG(buf.st_mode)) return kFile; 330 if (S_ISREG(buf.st_mode)) return kFile;
328 return kOther; 331 return kOther;
329 } 332 }
330 333
331 334
332 File::Type File::GetType(const char* pathname, bool follow_links) { 335 File::Type File::GetType(const char* pathname, bool follow_links) {
(...skipping 22 matching lines...) Expand all
355 return (file_1_info.st_ino == file_2_info.st_ino && 358 return (file_1_info.st_ino == file_2_info.st_ino &&
356 file_1_info.st_dev == file_2_info.st_dev) ? 359 file_1_info.st_dev == file_2_info.st_dev) ?
357 File::kIdentical : 360 File::kIdentical :
358 File::kDifferent; 361 File::kDifferent;
359 } 362 }
360 363
361 } // namespace bin 364 } // namespace bin
362 } // namespace dart 365 } // namespace dart
363 366
364 #endif // defined(TARGET_OS_MACOS) 367 #endif // defined(TARGET_OS_MACOS)
OLDNEW
« no previous file with comments | « runtime/bin/file_linux.cc ('k') | runtime/bin/process_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698