Bug 716126 - Include update.status contents inside maintenanceservice.log file on failed updates. r=rstrong

This commit is contained in:
Brian R. Bondy 2012-01-10 11:28:50 -05:00
parent c6e8133d18
commit 46b366aa42
3 changed files with 14 additions and 4 deletions

View File

@ -54,8 +54,8 @@ HANDLE gWorkDoneEvent = NULL;
HANDLE gThread = NULL;
bool gServiceControlStopping = false;
// logs are pretty small ~10 lines, so 5 seems reasonable.
#define LOGS_TO_KEEP 5
// logs are pretty small, about 20 lines, so 10 seems reasonable.
#define LOGS_TO_KEEP 10
BOOL GetLogDirectoryPath(WCHAR *path);

View File

@ -55,12 +55,12 @@ VerifySameFiles(LPCWSTR file1Path, LPCWSTR file2Path, BOOL &sameContent)
sameContent = FALSE;
nsAutoHandle file1(CreateFileW(file1Path, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, 0, NULL));
if (!file1) {
if (INVALID_HANDLE_VALUE == file1) {
return FALSE;
}
nsAutoHandle file2(CreateFileW(file2Path, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, 0, NULL));
if (!file2) {
if (INVALID_HANDLE_VALUE == file2) {
return FALSE;
}

View File

@ -92,6 +92,7 @@ IsStatusApplying(LPCWSTR updateDirPath, BOOL &isApplying)
WCHAR updateStatusFilePath[MAX_PATH + 1];
wcscpy(updateStatusFilePath, updateDirPath);
if (!PathAppendSafe(updateStatusFilePath, L"update.status")) {
LOG(("Warning: Could not append path for update.status file\n"));
return FALSE;
}
@ -100,12 +101,21 @@ IsStatusApplying(LPCWSTR updateDirPath, BOOL &isApplying)
FILE_SHARE_WRITE |
FILE_SHARE_DELETE,
NULL, OPEN_EXISTING, 0, NULL));
if (INVALID_HANDLE_VALUE == statusFile) {
LOG(("Warning: Could not open update.status file\n"));
return FALSE;
}
char buf[32] = { 0 };
DWORD read;
if (!ReadFile(statusFile, buf, sizeof(buf), &read, NULL)) {
LOG(("Warning: Could not read from update.status file\n"));
return FALSE;
}
LOG(("updater.exe returned status: %s\n", buf));
const char kApplying[] = "applying";
isApplying = strncmp(buf, kApplying,
sizeof(kApplying) - 1) == 0;