From: krasimir Date: Fri, 20 May 2005 14:40:50 +0000 (+0000) Subject: [project @ 2005-05-20 14:40:50 by krasimir] X-Git-Tag: Initial_conversion_from_CVS_complete~499 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=65ebd31adfb737e823431e87ecb6830f81d0bb58;p=ghc-hetmet.git [project @ 2005-05-20 14:40:50 by krasimir] Bugfix: in rtsFatalInternalErrorFn vsnprintf function was used instead of snprintf. The code is changed so that the error message will be displayed even if it is longer that BUFSIZE. --- diff --git a/ghc/rts/RtsMessages.c b/ghc/rts/RtsMessages.c index 5df2fe4..aefee4c 100644 --- a/ghc/rts/RtsMessages.c +++ b/ghc/rts/RtsMessages.c @@ -114,21 +114,15 @@ rtsFatalInternalErrorFn(char *s, va_list ap) if (isGUIApp()) { char title[BUFSIZE], message[BUFSIZE]; - int r; - r = vsnprintf(title, BUFSIZE, "%s: internal error", prog_name); - if (r > 0 && r < BUFSIZE) { - strcpy(title, "internal error"); - } + snprintf(title, BUFSIZE, "%s: internal error", prog_name); + vsnprintf(message, BUFSIZE, s, ap); - r = vsnprintf(message, BUFSIZE, s, ap); - if (r > 0 && r < BUFSIZE) { - MessageBox(NULL /* hWnd */, - message, - title, - MB_OK | MB_ICONERROR | MB_TASKMODAL - ); - }; + MessageBox(NULL /* hWnd */, + message, + title, + MB_OK | MB_ICONERROR | MB_TASKMODAL + ); } else #endif