예제 #1
0
/*********************************************************************
 *
 * Function    :  fatal_error
 *
 * Description :  Displays a fatal error to standard error (or, on
 *                a WIN32 GUI, to a dialog box), and exits Privoxy
 *                with status code 1.
 *
 * Parameters  :
 *          1  :  error_message = The error message to display.
 *
 * Returns     :  Does not return.
 *
 *********************************************************************/
static void fatal_error(const char *error_message)
{
#if defined(_WIN32) && !defined(_WIN_CONSOLE)
   /* Skip timestamp and thread id for the message box. */
   const char *box_message = strstr(error_message, "Fatal error");
   if (NULL == box_message)
   {
      /* Shouldn't happen but ... */
      box_message = error_message;
   }
   MessageBox(g_hwndLogFrame, box_message, "Privoxy Error",
      MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_SETFOREGROUND | MB_TOPMOST);

   /* Cleanup - remove taskbar icon etc. */
   TermLogWindow();
#endif /* defined(_WIN32) && !defined(_WIN_CONSOLE) */

   if (logfp != NULL)
   {
      fputs(error_message, logfp);
   }

#if defined(unix)
   if (pidfile)
   {
      unlink(pidfile);
   }
#endif /* unix */

   exit(1);
}
예제 #2
0
/*********************************************************************
 *
 * Function    :  fatal_error
 *
 * Description :  Displays a fatal error to standard error (or, on 
 *                a WIN32 GUI, to a dialog box), and exits
 *                JunkBuster with status code 1.
 *
 * Parameters  :
 *          1  :  error_message = The error message to display.
 *
 * Returns     :  Does not return.
 *
 *********************************************************************/
static void fatal_error(const char * error_message)
{
#if defined(_WIN32) && !defined(_WIN_CONSOLE)
   MessageBox(g_hwndLogFrame, error_message, "Privoxy Error", 
      MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_SETFOREGROUND | MB_TOPMOST);  

   /* Cleanup - remove taskbar icon etc. */
   TermLogWindow();

#else /* if !defined(_WIN32) || defined(_WIN_CONSOLE) */
   fputs(error_message, stderr);
#endif /* defined(_WIN32) && !defined(_WIN_CONSOLE) */

#if defined(unix)
   unlink(pidfile);
#endif /* unix */

   exit(1);
}