summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/Platform.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Target/Platform.cpp')
-rw-r--r--lldb/source/Target/Platform.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index d3f265da09e..d92bf12dffa 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -773,9 +773,12 @@ Error Platform::MakeDirectory(const FileSpec &file_spec, uint32_t permissions) {
Error Platform::GetFilePermissions(const FileSpec &file_spec,
uint32_t &file_permissions) {
- if (IsHost())
- return FileSystem::GetFilePermissions(file_spec, file_permissions);
- else {
+ if (IsHost()) {
+ auto Value = llvm::sys::fs::getPermissions(file_spec.GetPath());
+ if (Value)
+ file_permissions = Value.get();
+ return Error(Value.getError());
+ } else {
Error error;
error.SetErrorStringWithFormat("remote platform %s doesn't support %s",
GetPluginName().GetCString(),
@@ -786,9 +789,10 @@ Error Platform::GetFilePermissions(const FileSpec &file_spec,
Error Platform::SetFilePermissions(const FileSpec &file_spec,
uint32_t file_permissions) {
- if (IsHost())
- return FileSystem::SetFilePermissions(file_spec, file_permissions);
- else {
+ if (IsHost()) {
+ auto Perms = static_cast<llvm::sys::fs::perms>(file_permissions);
+ return llvm::sys::fs::setPermissions(file_spec.GetPath(), Perms);
+ } else {
Error error;
error.SetErrorStringWithFormat("remote platform %s doesn't support %s",
GetPluginName().GetCString(),
OpenPOWER on IntegriCloud