Commit 7d6cc2be authored by Greg Thompson's avatar Greg Thompson Committed by Commit Bot

Fix use of logging macros in InstallServiceWorkItemImpl.

Don't do work within the expression side of LOG_IF macros, as it isn't
evaluated when logging is not enabled at the desired log level.

BUG=1023080
R=ganesh@chromium.org

Change-Id: I4a510eca6fe08e160d8ecd3cbaec8637b89dab2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2059014
Commit-Queue: Greg Thompson <grt@chromium.org>
Auto-Submit: Greg Thompson <grt@chromium.org>
Reviewed-by: default avatarS. Ganesh <ganesh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742051}
parent 1431d28a
......@@ -163,7 +163,8 @@ bool InstallServiceWorkItemImpl::DoImpl() {
// Save the original service name. Then create a new service name so as to not
// conflict with the previous one to be safe, then install the new service.
original_service_name_ = GetCurrentServiceName();
LOG_IF(WARNING, !CreateAndSetServiceName());
if (!CreateAndSetServiceName())
PLOG(ERROR) << "Failed to create and set unique service name";
ScopedScHandle original_service = std::move(service_);
if (InstallNewService()) {
......@@ -227,13 +228,17 @@ void InstallServiceWorkItemImpl::RollbackImpl() {
if (original_service_still_exists_) {
// Set only the service name back to original_service_name_ and return.
LOG_IF(WARNING, !SetServiceName(original_service_name_));
if (!SetServiceName(original_service_name_)) {
PLOG(ERROR) << "Failed to restore service name to "
<< original_service_name_;
}
return;
}
// Recreate original service with a new service name to avoid possible SCM
// issues with reusing the old name.
LOG_IF(WARNING, !CreateAndSetServiceName());
if (!CreateAndSetServiceName())
PLOG(ERROR) << "Failed to create and set unique service name";
if (!ReinstallOriginalService())
RecordWin32ApiErrorCode(kCreateService);
}
......
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