Commit b51e5467 authored by Allen Vicencio's avatar Allen Vicencio Committed by Commit Bot

Return success in WriteFile when writing from an empty buffer.

Changes WriteFile to return without calling D-Bus when attempting to write from an empty buffer.

Bug: chromium:757625
Change-Id: I386a571347ccf84785147ae91edea515b84a507a
Reviewed-on: https://chromium-review.googlesource.com/1005776Reviewed-by: default avatarZentaro Kavanagh <zentaro@chromium.org>
Commit-Queue: Allen Vicencio <allenvic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551047}
parent 76e77461
...@@ -387,6 +387,11 @@ AbortCallback SmbFileSystem::WriteFile( ...@@ -387,6 +387,11 @@ AbortCallback SmbFileSystem::WriteFile(
int64_t offset, int64_t offset,
int length, int length,
storage::AsyncFileUtil::StatusCallback callback) { storage::AsyncFileUtil::StatusCallback callback) {
if (length == 0) {
std::move(callback).Run(base::File::FILE_OK);
return CreateAbortCallback();
}
const std::vector<uint8_t> data(buffer->data(), buffer->data() + length); const std::vector<uint8_t> data(buffer->data(), buffer->data() + length);
base::ScopedFD temp_fd = temp_file_manager_.CreateTempFile(data); base::ScopedFD temp_fd = temp_file_manager_.CreateTempFile(data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment