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

Side by Side Diff: base/file_util_posix.cc

Issue 290143005: Update default WriteFile permissions to 0640 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 (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/file_util.h" 5 #include "base/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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 return -1; 658 return -1;
659 659
660 ssize_t bytes_read = HANDLE_EINTR(read(fd, data, max_size)); 660 ssize_t bytes_read = HANDLE_EINTR(read(fd, data, max_size));
661 if (IGNORE_EINTR(close(fd)) < 0) 661 if (IGNORE_EINTR(close(fd)) < 0)
662 return -1; 662 return -1;
663 return bytes_read; 663 return bytes_read;
664 } 664 }
665 665
666 int WriteFile(const FilePath& filename, const char* data, int size) { 666 int WriteFile(const FilePath& filename, const char* data, int size) {
667 ThreadRestrictions::AssertIOAllowed(); 667 ThreadRestrictions::AssertIOAllowed();
668 int fd = HANDLE_EINTR(creat(filename.value().c_str(), 0666)); 668 int fd = HANDLE_EINTR(creat(filename.value().c_str(), 0640));
669 if (fd < 0) 669 if (fd < 0)
670 return -1; 670 return -1;
671 671
672 int bytes_written = WriteFileDescriptor(fd, data, size); 672 int bytes_written = WriteFileDescriptor(fd, data, size);
673 if (IGNORE_EINTR(close(fd)) < 0) 673 if (IGNORE_EINTR(close(fd)) < 0)
674 return -1; 674 return -1;
675 return bytes_written; 675 return bytes_written;
676 } 676 }
677 677
678 int WriteFileDescriptor(const int fd, const char* data, int size) { 678 int WriteFileDescriptor(const int fd, const char* data, int size) {
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 result = false; 890 result = false;
891 if (IGNORE_EINTR(close(outfile)) < 0) 891 if (IGNORE_EINTR(close(outfile)) < 0)
892 result = false; 892 result = false;
893 893
894 return result; 894 return result;
895 } 895 }
896 #endif // !defined(OS_MACOSX) 896 #endif // !defined(OS_MACOSX)
897 897
898 } // namespace internal 898 } // namespace internal
899 } // namespace base 899 } // 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