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

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

Issue 1396613004: Use permissions 0666 on POSIX platforms except Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Just use 0666 Created 5 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
« 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 (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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 return -1; 667 return -1;
668 668
669 ssize_t bytes_read = HANDLE_EINTR(read(fd, data, max_size)); 669 ssize_t bytes_read = HANDLE_EINTR(read(fd, data, max_size));
670 if (IGNORE_EINTR(close(fd)) < 0) 670 if (IGNORE_EINTR(close(fd)) < 0)
671 return -1; 671 return -1;
672 return bytes_read; 672 return bytes_read;
673 } 673 }
674 674
675 int WriteFile(const FilePath& filename, const char* data, int size) { 675 int WriteFile(const FilePath& filename, const char* data, int size) {
676 ThreadRestrictions::AssertIOAllowed(); 676 ThreadRestrictions::AssertIOAllowed();
677 int fd = HANDLE_EINTR(creat(filename.value().c_str(), 0640)); 677 int fd = HANDLE_EINTR(creat(filename.value().c_str(), 0666));
678 if (fd < 0) 678 if (fd < 0)
679 return -1; 679 return -1;
680 680
681 int bytes_written = WriteFileDescriptor(fd, data, size) ? size : -1; 681 int bytes_written = WriteFileDescriptor(fd, data, size) ? size : -1;
682 if (IGNORE_EINTR(close(fd)) < 0) 682 if (IGNORE_EINTR(close(fd)) < 0)
683 return -1; 683 return -1;
684 return bytes_written; 684 return bytes_written;
685 } 685 }
686 686
687 bool WriteFileDescriptor(const int fd, const char* data, int size) { 687 bool WriteFileDescriptor(const int fd, const char* data, int size) {
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 return false; 914 return false;
915 915
916 DeleteFile(from_path, true); 916 DeleteFile(from_path, true);
917 return true; 917 return true;
918 } 918 }
919 919
920 } // namespace internal 920 } // namespace internal
921 921
922 #endif // !defined(OS_NACL_NONSFI) 922 #endif // !defined(OS_NACL_NONSFI)
923 } // namespace base 923 } // namespace 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