Commit 20656ca8 authored by Michael Li (EDGE)'s avatar Michael Li (EDGE) Committed by Commit Bot

Set last-error code in DeleteFileAndRecordMetrics if deletion failed

Bug: 1133844
Change-Id: I5c0c5baa21e591db236cebba80697eb75f9612ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2450073
Commit-Queue: Michael Li <michli@microsoft.com>
Reviewed-by: default avatarGreg Thompson <grt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814422}
parent 753eff8e
......@@ -352,6 +352,9 @@ DWORD DoDeleteFile(const FilePath& path, bool recursive) {
: ReturnLastErrorOrSuccessOnNotFound();
}
// Deletes the file/directory at |path| (recursively if |recursive| and |path|
// names a directory), returning true on success. Sets the Windows last-error
// code and returns false on failure.
bool DeleteFileAndRecordMetrics(const FilePath& path, bool recursive) {
static constexpr char kRecursive[] = "DeleteFile.Recursive";
static constexpr char kNonRecursive[] = "DeleteFile.NonRecursive";
......@@ -369,6 +372,8 @@ bool DeleteFileAndRecordMetrics(const FilePath& path, bool recursive) {
return true;
RecordFilesystemError(operation, error);
::SetLastError(error);
return false;
}
......
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