| 581 | } |
| 582 | |
| 583 | void |
| 584 | impossible(const char *s, ...) |
| 585 | { |
| 586 | va_list the_args; |
| 587 | char pbuf[BIGBUFSZ]; /* will be chopped down to BUFSZ-1 if longer */ |
| 588 | char pbuf2[BUFSZ]; |
| 589 | |
| 590 | va_start(the_args, s); |
| 591 | if (program_state.in_impossible) |
| 592 | panic("impossible called impossible"); |
| 593 | |
| 594 | program_state.in_impossible = 1; |
| 595 | (void) vsnprintf(pbuf, sizeof pbuf, s, the_args); |
| 596 | va_end(the_args); |
| 597 | pbuf[BUFSZ - 1] = '\0'; /* sanity */ |
| 598 | paniclog("impossible", pbuf); |
| 599 | if (iflags.debug_fuzzer == fuzzer_impossible_panic) |
| 600 | panic("%s", pbuf); |
| 601 | |
| 602 | gp.pline_flags = URGENT_MESSAGE; |
| 603 | pline("%s", pbuf); |
| 604 | gp.pline_flags = 0; |
| 605 | |
| 606 | if (program_state.in_sanity_check) { |
| 607 | /* skip rest of multi-line feedback */ |
| 608 | program_state.in_impossible = 0; |
| 609 | return; |
| 610 | } |
| 611 | |
| 612 | Strcpy(pbuf2, "Program in disorder!"); |
| 613 | if (program_state.something_worth_saving) |
| 614 | Strcat(pbuf2, " (Saving and reloading may fix this problem.)"); |
| 615 | pline("%s", pbuf2); |
| 616 | pline("Please report these messages to %s.", DEVTEAM_EMAIL); |
| 617 | if (sysopt.support) { |
| 618 | pline("Alternatively, contact local support: %s", sysopt.support); |
| 619 | } |
| 620 | |
| 621 | #ifdef CRASHREPORT |
| 622 | if (sysopt.crashreporturl) { |
| 623 | boolean report = ('y' == yn_function("Report now?", ynchars, |
| 624 | 'n', FALSE)); |
| 625 | |
| 626 | raw_print(""); /* prove to the user the character was accepted */ |
| 627 | if (report) { |
| 628 | submit_web_report(1, "Impossible", pbuf); |
| 629 | } |
| 630 | } |
| 631 | #endif |
| 632 | |
| 633 | program_state.in_impossible = 0; |
| 634 | } |
| 635 | |
| 636 | RESTORE_WARNING_FORMAT_NONLITERAL |
| 637 |
no test coverage detected