8c172e6c4b985af79bf1a1f47c9db92ce0578999 max Tue Sep 15 05:47:36 2026 -0700 errCatch: put errAbort's doContentType back the way it found it, refs #38353 hVaUserAbort() turns doContentType on so that a user error reaches the browser when the CGI has not pushed a warn handler of its own. Inside an errCatch that is pointless -- the abort is caught and never reaches the default handler -- and the flag stayed on afterwards, so a later genuine abort on a page that had already written its header would print a second Content-Type line into the body. Everywhere else in the tree the flag is something a caller turns back off. errCatchPushHandlers() now records the flag and errCatchEnd() restores it, which covers every caller rather than just the one that set it. errAbortGetDoContentType() is the reader. diff --git src/lib/errAbort.c src/lib/errAbort.c index f3f5e7e70df..5ad75e34a69 100644 --- src/lib/errAbort.c +++ src/lib/errAbort.c @@ -250,30 +250,36 @@ * perfect, as this isn't cleared if the error handler continues, * as with an exception mechanism. */ struct perThreadAbortVars *ptav = getThreadVars(); ptav->errAbortInProgress = TRUE; vaWarn(format, args); noWarnAbort(); } void errAbortSetDoContentType(boolean value) /* change the setting of doContentType, ie. if errorAbort should print a * http Content type line. */ { doContentType = value; } +boolean errAbortGetDoContentType() +/* Current setting of doContentType, so that a caller which changes it can put it back. */ +{ +return doContentType; +} + void errAbort(char *format, ...) /* Abort function, with optional (printf formatted) error message. */ { #ifdef COREDUMP abort(); #endif va_list args; va_start(args, format); vaErrAbort(format, args); va_end(args); } void errnoAbort(char *format, ...) /* Prints error message from UNIX errno first, then does errAbort. */ {