mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 15:47:01 +02:00
MINOR: init: report in "haproxy -c" whether there were warnings or not
This helps quickly checking if the config produces any warning. For this we reuse the "warned" bit field to add a new WARN_ANY bit that is set by ha_warning(). The rest of the bit field was also cleaned from unused bits.
This commit is contained in:
parent
8ba10fea69
commit
bebd212064
@ -193,7 +193,7 @@ list of options is :
|
|||||||
|
|
||||||
-c : only performs a check of the configuration files and exits before trying
|
-c : only performs a check of the configuration files and exits before trying
|
||||||
to bind. The exit status is zero if everything is OK, or non-zero if an
|
to bind. The exit status is zero if everything is OK, or non-zero if an
|
||||||
error is encountered.
|
error is encountered. Presence of warnings will be reported if any.
|
||||||
|
|
||||||
-d : enable debug mode. This disables daemon mode, forces the process to stay
|
-d : enable debug mode. This disables daemon mode, forces the process to stay
|
||||||
in foreground and to show incoming and outgoing events. It is equivalent to
|
in foreground and to show incoming and outgoing events. It is equivalent to
|
||||||
|
@ -242,13 +242,8 @@ extern int atexit_flag;
|
|||||||
extern unsigned char boot_seed[20]; // per-boot random seed (160 bits initially)
|
extern unsigned char boot_seed[20]; // per-boot random seed (160 bits initially)
|
||||||
|
|
||||||
/* bit values to go with "warned" above */
|
/* bit values to go with "warned" above */
|
||||||
/* unassigned : 0x00000001 (previously: WARN_BLOCK_DEPRECATED) */
|
#define WARN_ANY 0x00000001 /* any warning was emitted */
|
||||||
/* unassigned : 0x00000002 */
|
#define WARN_FORCECLOSE_DEPRECATED 0x00000002
|
||||||
/* unassigned : 0x00000004 (previously: WARN_REDISPATCH_DEPRECATED) */
|
|
||||||
/* unassigned : 0x00000008 (previously: WARN_CLITO_DEPRECATED) */
|
|
||||||
/* unassigned : 0x00000010 (previously: WARN_SRVTO_DEPRECATED) */
|
|
||||||
/* unassigned : 0x00000020 (previously: WARN_CONTO_DEPRECATED) */
|
|
||||||
#define WARN_FORCECLOSE_DEPRECATED 0x00000040
|
|
||||||
|
|
||||||
|
|
||||||
/* to be used with warned and WARN_* */
|
/* to be used with warned and WARN_* */
|
||||||
|
@ -2101,6 +2101,9 @@ static void init(int argc, char **argv)
|
|||||||
struct peers *pr;
|
struct peers *pr;
|
||||||
struct proxy *px;
|
struct proxy *px;
|
||||||
|
|
||||||
|
if (warned & WARN_ANY)
|
||||||
|
qfprintf(stdout, "Warnings were found.\n");
|
||||||
|
|
||||||
for (pr = cfg_peers; pr; pr = pr->next)
|
for (pr = cfg_peers; pr; pr = pr->next)
|
||||||
if (pr->peers_fe)
|
if (pr->peers_fe)
|
||||||
break;
|
break;
|
||||||
|
@ -1123,6 +1123,8 @@ void ha_warning(const char *fmt, ...)
|
|||||||
{
|
{
|
||||||
va_list argp;
|
va_list argp;
|
||||||
|
|
||||||
|
warned |= WARN_ANY;
|
||||||
|
|
||||||
if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) {
|
if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) {
|
||||||
va_start(argp, fmt);
|
va_start(argp, fmt);
|
||||||
print_message("WARNING", fmt, argp);
|
print_message("WARNING", fmt, argp);
|
||||||
|
Loading…
Reference in New Issue
Block a user