mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-26 04:09:30 +03:00
62 lines
1.9 KiB
C
62 lines
1.9 KiB
C
/*
|
|
This file is part of libmicrohttpd
|
|
Copyright (C) 2007-2018 Daniel Pittman and Christian Grothoff
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with this library; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
/**
|
|
* @file lib/panic.c
|
|
* @brief functions to panic (abort)
|
|
* @author Christian Grothoff
|
|
*/
|
|
#include "internal.h"
|
|
|
|
|
|
/**
|
|
* Handler for fatal errors.
|
|
*/
|
|
MHD_PanicCallback mhd_panic = NULL;
|
|
|
|
/**
|
|
* Closure argument for #mhd_panic.
|
|
*/
|
|
void *mhd_panic_cls = NULL;
|
|
|
|
|
|
/**
|
|
* Sets the global error handler to a different implementation. @a cb
|
|
* will only be called in the case of typically fatal, serious
|
|
* internal consistency issues. These issues should only arise in the
|
|
* case of serious memory corruption or similar problems with the
|
|
* architecture. While @a cb is allowed to return and MHD will then
|
|
* try to continue, this is never safe.
|
|
*
|
|
* The default implementation that is used if no panic function is set
|
|
* simply prints an error message and calls `abort()`. Alternative
|
|
* implementations might call `exit()` or other similar functions.
|
|
*
|
|
* @param cb new error handler
|
|
* @param cls passed to @a cb
|
|
* @ingroup logging
|
|
*/
|
|
void
|
|
MHD_set_panic_func (MHD_PanicCallback cb,
|
|
void *cls)
|
|
{
|
|
mhd_panic = cb;
|
|
mhd_panic_cls = cls;
|
|
}
|