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, 8 insertions, 8 deletions
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index fac9b56026b..482c8b503c6 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -1226,15 +1226,15 @@ Status Platform::PutFile(const FileSpec &source, const FileSpec &destination,
if (fs::is_symlink_file(source.GetPath()))
source_open_options |= File::eOpenOptionDontFollowSymlinks;
- File source_file;
- Status error = FileSystem::Instance().Open(
- source_file, source, source_open_options, lldb::eFilePermissionsUserRW);
- uint32_t permissions = source_file.GetPermissions(error);
+ auto source_file = FileSystem::Instance().Open(
+ source, source_open_options, lldb::eFilePermissionsUserRW);
+ if (!source_file)
+ return Status(source_file.takeError());
+ Status error;
+ uint32_t permissions = source_file.get()->GetPermissions(error);
if (permissions == 0)
permissions = lldb::eFilePermissionsFileDefault;
- if (!source_file.IsValid())
- return Status("PutFile: unable to open source file");
lldb::user_id_t dest_file = OpenFile(
destination, File::eOpenOptionCanCreate | File::eOpenOptionWrite |
File::eOpenOptionTruncate | File::eOpenOptionCloseOnExec,
@@ -1249,7 +1249,7 @@ Status Platform::PutFile(const FileSpec &source, const FileSpec &destination,
uint64_t offset = 0;
for (;;) {
size_t bytes_read = buffer_sp->GetByteSize();
- error = source_file.Read(buffer_sp->GetBytes(), bytes_read);
+ error = source_file.get()->Read(buffer_sp->GetBytes(), bytes_read);
if (error.Fail() || bytes_read == 0)
break;
@@ -1262,7 +1262,7 @@ Status Platform::PutFile(const FileSpec &source, const FileSpec &destination,
if (bytes_written != bytes_read) {
// We didn't write the correct number of bytes, so adjust the file
// position in the source file we are reading from...
- source_file.SeekFromStart(offset);
+ source_file.get()->SeekFromStart(offset);
}
}
CloseFile(dest_file, error);
OpenPOWER on IntegriCloud