status = Perl_do_open9(aTHX_ handle_orig, ">&", 2, FALSE, O_WRONLY, 0, Nullfp, (SV*)handle, 1); Perl_do_close(aTHX_ handle, FALSE); (void)hv_delete(gv_stashpv("Apache::RequestIO", TRUE), GvNAME(handle), GvNAMELEN(handle), G_DISCARD); if (status == 0) { Perl_croak(aTHX_ "Failed to restore STDOUT: %_", get_sv("!", TRUE));
Perl_do_close(aTHX_ handle_orig, FALSE);   if (handle != (GV*)Nullsv) { SV *err = Nullsv;  MP_TRACE_o(MP_FUNC, "restoring STDOUT");  if (Perl_do_open9(aTHX_ handle_orig, ">&", 2, FALSE, O_WRONLY, 0, Nullfp, (SV*)handle, 1) == 0) { err = get_sv("!", TRUE); }  Perl_do_close(aTHX_ handle, FALSE); (void)hv_delete(gv_stashpv("Apache::RequestIO", TRUE), GvNAME(handle), GvNAMELEN(handle), G_DISCARD);  if (err != Nullsv) { Perl_croak(aTHX_ "Failed to restore STDOUT: %_", err); }
MP_INLINE void modperl_io_perlio_restore_stdout(pTHX_ GV *handle){     GV *handle_orig = gv_fetchpv("STDOUT", FALSE, SVt_PVIO);    int status;    MP_TRACE_o(MP_FUNC, "start");    /* since closing unflushed STDOUT may trigger a subrequest     * (e.g. via mod_include), resulting in potential another response     * handler call, which may try to close STDOUT too. We will     * segfault, if that subrequest doesn't return before the the top     * level STDOUT is attempted to be closed. To prevent this     * situation always explicitly flush STDOUT, before reopening it.     */    if (GvIOn(handle_orig) && IoOFP(GvIOn(handle_orig))) {        PerlIO_flush(IoOFP(GvIOn(handle_orig)));    }    /* open STDOUT, ">&STDOUT_SAVED" or die "Can't dup STDOUT_SAVED: $!"; */    /* open first closes STDOUT */    status = Perl_do_open9(aTHX_ handle_orig, ">&", 2, FALSE, O_WRONLY,                           0, Nullfp, (SV*)handle, 1);    Perl_do_close(aTHX_ handle, FALSE);    (void)hv_delete(gv_stashpv("Apache::RequestIO", TRUE), 		    GvNAME(handle), GvNAMELEN(handle), G_DISCARD);    if (status == 0) {        Perl_croak(aTHX_ "Failed to restore STDOUT: %_", get_sv("!", TRUE));    }    MP_TRACE_o(MP_FUNC, "end\n");}