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

Side by Side Diff: base/files/file_util_posix.cc

Issue 1154313003: Non-SFI mode: Implement test launcher for nacl_helper_nonsfi_unittests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « base/files/file_util.cc ('k') | base/test/BUILD.gn » ('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 Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium 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 #include "base/files/file_util.h" 5 #include "base/files/file_util.h"
6 6
7 #include <dirent.h> 7 #include <dirent.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <libgen.h> 10 #include <libgen.h>
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 #endif // defined(OS_ANDROID) 644 #endif // defined(OS_ANDROID)
645 if (CallStat(file_path.value().c_str(), &file_info) != 0) 645 if (CallStat(file_path.value().c_str(), &file_info) != 0)
646 return false; 646 return false;
647 #if defined(OS_ANDROID) 647 #if defined(OS_ANDROID)
648 } 648 }
649 #endif // defined(OS_ANDROID) 649 #endif // defined(OS_ANDROID)
650 650
651 results->FromStat(file_info); 651 results->FromStat(file_info);
652 return true; 652 return true;
653 } 653 }
654 #endif // !defined(OS_NACL_NONSFI)
654 655
655 FILE* OpenFile(const FilePath& filename, const char* mode) { 656 FILE* OpenFile(const FilePath& filename, const char* mode) {
656 ThreadRestrictions::AssertIOAllowed(); 657 ThreadRestrictions::AssertIOAllowed();
657 FILE* result = NULL; 658 FILE* result = NULL;
658 do { 659 do {
659 result = fopen(filename.value().c_str(), mode); 660 result = fopen(filename.value().c_str(), mode);
660 } while (!result && errno == EINTR); 661 } while (!result && errno == EINTR);
661 return result; 662 return result;
662 } 663 }
663 664
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 bytes_written_partial = 704 bytes_written_partial =
704 HANDLE_EINTR(write(fd, data + bytes_written_total, 705 HANDLE_EINTR(write(fd, data + bytes_written_total,
705 size - bytes_written_total)); 706 size - bytes_written_total));
706 if (bytes_written_partial < 0) 707 if (bytes_written_partial < 0)
707 return false; 708 return false;
708 } 709 }
709 710
710 return true; 711 return true;
711 } 712 }
712 713
714 #if !defined(OS_NACL_NONSFI)
715
713 bool AppendToFile(const FilePath& filename, const char* data, int size) { 716 bool AppendToFile(const FilePath& filename, const char* data, int size) {
714 ThreadRestrictions::AssertIOAllowed(); 717 ThreadRestrictions::AssertIOAllowed();
715 bool ret = true; 718 bool ret = true;
716 int fd = HANDLE_EINTR(open(filename.value().c_str(), O_WRONLY | O_APPEND)); 719 int fd = HANDLE_EINTR(open(filename.value().c_str(), O_WRONLY | O_APPEND));
717 if (fd < 0) { 720 if (fd < 0) {
718 VPLOG(1) << "Unable to create file " << filename.value(); 721 VPLOG(1) << "Unable to create file " << filename.value();
719 return false; 722 return false;
720 } 723 }
721 724
722 // This call will either write all of the data or return false. 725 // This call will either write all of the data or return false.
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 return false; 926 return false;
924 927
925 DeleteFile(from_path, true); 928 DeleteFile(from_path, true);
926 return true; 929 return true;
927 } 930 }
928 931
929 } // namespace internal 932 } // namespace internal
930 933
931 #endif // !defined(OS_NACL_NONSFI) 934 #endif // !defined(OS_NACL_NONSFI)
932 } // namespace base 935 } // namespace base
OLDNEW
« no previous file with comments | « base/files/file_util.cc ('k') | base/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698