fusee: handle case where saving a fatal report fails (thanks @HookedBehemoth)

This commit is contained in:
hexkyz 2020-06-26 18:36:30 +01:00 committed by GitHub
parent f197b88dd7
commit fdc7ef62f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -90,9 +90,12 @@ static void _check_and_display_atmosphere_fatal_error(void) {
char filepath[0x40]; char filepath[0x40];
snprintf(filepath, sizeof(filepath) - 1, "/atmosphere/fatal_errors/report_%016llx.bin", ctx.report_identifier); snprintf(filepath, sizeof(filepath) - 1, "/atmosphere/fatal_errors/report_%016llx.bin", ctx.report_identifier);
filepath[sizeof(filepath)-1] = 0; filepath[sizeof(filepath)-1] = 0;
write_to_file(&ctx, sizeof(ctx), filepath); if (write_to_file(&ctx, sizeof(ctx), filepath) != sizeof(ctx)) {
print(SCREEN_LOG_LEVEL_ERROR | SCREEN_LOG_LEVEL_NO_PREFIX, "Failed to save report to the SD card!\n");
} else {
print(SCREEN_LOG_LEVEL_ERROR | SCREEN_LOG_LEVEL_NO_PREFIX, "Report saved to %s\n", filepath); print(SCREEN_LOG_LEVEL_ERROR | SCREEN_LOG_LEVEL_NO_PREFIX, "Report saved to %s\n", filepath);
} }
}
/* Display error. */ /* Display error. */
print(SCREEN_LOG_LEVEL_ERROR | SCREEN_LOG_LEVEL_NO_PREFIX, "\nPress POWER to reboot\n"); print(SCREEN_LOG_LEVEL_ERROR | SCREEN_LOG_LEVEL_NO_PREFIX, "\nPress POWER to reboot\n");