|
Packit Service |
5956c7 |
/*
|
|
Packit Service |
5956c7 |
* Soft: Keepalived is a failover program for the LVS project
|
|
Packit Service |
5956c7 |
* <www.linuxvirtualserver.org>. It monitor & manipulate
|
|
Packit Service |
5956c7 |
* a loadbalanced server pool using multi-layer checks.
|
|
Packit Service |
5956c7 |
*
|
|
Packit Service |
5956c7 |
* Part: assert facility.
|
|
Packit Service |
5956c7 |
*
|
|
Packit Service |
5956c7 |
* Author: Alexandre Cassen, <acassen@linux-vs.org>
|
|
Packit Service |
5956c7 |
*
|
|
Packit Service |
5956c7 |
* This program is distributed in the hope that it will be useful,
|
|
Packit Service |
5956c7 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
5956c7 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
Packit Service |
5956c7 |
* See the GNU General Public License for more details.
|
|
Packit Service |
5956c7 |
*
|
|
Packit Service |
5956c7 |
* This program is free software; you can redistribute it and/or
|
|
Packit Service |
5956c7 |
* modify it under the terms of the GNU General Public License
|
|
Packit Service |
5956c7 |
* as published by the Free Software Foundation; either version
|
|
Packit Service |
5956c7 |
* 2 of the License, or (at your option) any later version.
|
|
Packit Service |
5956c7 |
*
|
|
Packit Service |
5956c7 |
* Copyright (C) 2018-2018 Alexandre Cassen, <acassen@gmail.com>
|
|
Packit Service |
5956c7 |
*/
|
|
Packit Service |
5956c7 |
#include "config.h"
|
|
Packit Service |
5956c7 |
|
|
Packit Service |
5956c7 |
#ifndef NDEBUG
|
|
Packit Service |
5956c7 |
|
|
Packit Service |
5956c7 |
#include <assert.h>
|
|
Packit Service |
5956c7 |
#include <stdlib.h>
|
|
Packit Service |
5956c7 |
#include <string.h>
|
|
Packit Service |
5956c7 |
|
|
Packit Service |
5956c7 |
#include "logger.h"
|
|
Packit Service |
5956c7 |
|
|
Packit Service |
5956c7 |
/* This prints an "Assertion failed" message and aborts. */
|
|
Packit Service |
5956c7 |
void __assert_fail (const char *__assertion, const char *__file,
|
|
Packit Service |
5956c7 |
LINE_type __line, const char *__function)
|
|
Packit Service |
5956c7 |
{
|
|
Packit Service |
5956c7 |
log_message(LOG_ERR, "assert: %s:%d: %s: Assertion: `%s' failed.", __file, __line, __function, __assertion);
|
|
Packit Service |
5956c7 |
abort();
|
|
Packit Service |
5956c7 |
}
|
|
Packit Service |
5956c7 |
|
|
Packit Service |
5956c7 |
#ifdef __USE_GNU
|
|
Packit Service |
5956c7 |
/* Likewise, but prints the error text for ERRNUM. */
|
|
Packit Service |
5956c7 |
void __assert_perror_fail (int __errnum, const char *__file,
|
|
Packit Service |
5956c7 |
unsigned int __line, const char *__function)
|
|
Packit Service |
5956c7 |
{
|
|
Packit Service |
5956c7 |
log_message(LOG_ERR, "assert: %s:%d: %s: Unexpected error: %s.", __file, __line, __function, strerror(__errnum));
|
|
Packit Service |
5956c7 |
abort();
|
|
Packit Service |
5956c7 |
}
|
|
Packit Service |
5956c7 |
#endif
|
|
Packit Service |
5956c7 |
#endif
|