Commit 1e609523 authored by Chris Mumford's avatar Chris Mumford Committed by Commit Bot

Fail DCHECK if 0/ERROR_SUCCESS is passed into OSErrorToFileError.

The prior two values are not considered to be errors, and will be
mapped to FILE_ERROR_FAILED. Adding the DCHECK to detect incorrect
use of this function.

Bug: None
Change-Id: Id8dcfa01bf18010fc1a59fc20defb907475aac6c
Reviewed-on: https://chromium-review.googlesource.com/798050
Commit-Queue: Chris Mumford <cmumford@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521234}
parent cf116cc7
......@@ -424,6 +424,8 @@ File::Error File::OSErrorToFileError(int saved_errno) {
UMA_HISTOGRAM_SPARSE_SLOWLY("PlatformFile.UnknownErrors.Posix",
saved_errno);
#endif
// This function should only be called for errors.
DCHECK_NE(0, saved_errno);
return FILE_ERROR_FAILED;
}
}
......
......@@ -312,6 +312,8 @@ File::Error File::OSErrorToFileError(DWORD last_error) {
default:
UMA_HISTOGRAM_SPARSE_SLOWLY("PlatformFile.UnknownErrors.Windows",
last_error);
// This function should only be called for errors.
DCHECK_NE(static_cast<DWORD>(ERROR_SUCCESS), last_error);
return FILE_ERROR_FAILED;
}
}
......
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