summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Unix
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-07-08 16:42:01 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-07-08 16:42:01 +0000
commita8a9f1baf0c7733f32f2fc513aac1af7233251b4 (patch)
tree02b681d58bcca1e349268bbcf5d08dd3d474bda5 /llvm/lib/Support/Unix
parentba22e8d56d00211ea5f65a78be3c026bb2ebf047 (diff)
downloadbcm5719-llvm-a8a9f1baf0c7733f32f2fc513aac1af7233251b4.tar.gz
bcm5719-llvm-a8a9f1baf0c7733f32f2fc513aac1af7233251b4.zip
We now always create files with the correct permissions. Simplify the interface.
llvm-svn: 185834
Diffstat (limited to 'llvm/lib/Support/Unix')
-rw-r--r--llvm/lib/Support/Unix/Path.inc32
1 files changed, 1 insertions, 31 deletions
diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
index e23e0bd6186..433d187ffda 100644
--- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -569,7 +569,7 @@ error_code status(const Twine &path, file_status &result) {
return ec;
}
- perms prms = static_cast<perms>(status.st_mode & perms_mask);
+ perms prms = static_cast<perms>(status.st_mode);
if (S_ISDIR(status.st_mode))
result = file_status(file_type::directory_file, prms);
@@ -595,36 +595,6 @@ error_code status(const Twine &path, file_status &result) {
return error_code::success();
}
-// Modifies permissions on a file.
-error_code permissions(const Twine &path, perms prms) {
- if ((prms & add_perms) && (prms & remove_perms))
- llvm_unreachable("add_perms and remove_perms are mutually exclusive");
-
- // Get current permissions
- // FIXME: We only need this stat for add_perms and remove_perms.
- file_status info;
- if (error_code ec = status(path, info)) {
- return ec;
- }
-
- // Set updated permissions.
- SmallString<128> path_storage;
- StringRef p = path.toNullTerminatedStringRef(path_storage);
- perms permsToSet;
- if (prms & add_perms) {
- permsToSet = (info.permissions() | prms) & perms_mask;
- } else if (prms & remove_perms) {
- permsToSet = (info.permissions() & ~prms) & perms_mask;
- } else {
- permsToSet = prms & perms_mask;
- }
- if (::chmod(p.begin(), static_cast<mode_t>(permsToSet))) {
- return error_code(errno, system_category());
- }
-
- return error_code::success();
-}
-
error_code setLastModificationAndAccessTime(int FD, TimeValue Time) {
#if defined(HAVE_FUTIMENS)
timespec Times[2];
OpenPOWER on IntegriCloud