Merge "cleanup: PLOG(FATAL) crashes, does not need else branch" into main

This commit is contained in:
Treehugger Robot 2024-05-17 01:42:33 +00:00 committed by Gerrit Code Review
commit 4c3ebe4723

View file

@ -303,28 +303,27 @@ static void ReadCrashInfo(unique_fd& fd, siginfo_t* siginfo,
*recoverable_crash = false;
if (rc == -1) {
PLOG(FATAL) << "failed to read target ucontext";
} else {
ssize_t expected_size = 0;
switch (crash_info->header.version) {
case 1:
case 2:
case 3:
expected_size = sizeof(CrashInfoHeader) + sizeof(CrashInfoDataStatic);
break;
}
ssize_t expected_size = 0;
switch (crash_info->header.version) {
case 1:
case 2:
case 3:
expected_size = sizeof(CrashInfoHeader) + sizeof(CrashInfoDataStatic);
break;
case 4:
expected_size = sizeof(CrashInfoHeader) + sizeof(CrashInfoDataDynamic);
break;
case 4:
expected_size = sizeof(CrashInfoHeader) + sizeof(CrashInfoDataDynamic);
break;
default:
LOG(FATAL) << "unexpected CrashInfo version: " << crash_info->header.version;
break;
};
default:
LOG(FATAL) << "unexpected CrashInfo version: " << crash_info->header.version;
break;
};
if (rc < expected_size) {
LOG(FATAL) << "read " << rc << " bytes when reading target crash information, expected "
<< expected_size;
}
if (rc < expected_size) {
LOG(FATAL) << "read " << rc << " bytes when reading target crash information, expected "
<< expected_size;
}
switch (crash_info->header.version) {