mirror of
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git
synced 2024-11-15 14:05:22 +08:00
24b058a2a4
Commit 959f1428
("color: add new COLOR_NONE and disable_color function")
introducing color enum COLOR_NONE, which is not only duplicite of
COLOR_CLEAR, but also caused segfault, when running ip with --color
switch, as 'attr + 8' in color_fprintf() access array item out of
bounds. Thus removing it and restoring "magic" offset + 7.
Reproduce with:
$ ip -c a
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
22 lines
444 B
C
22 lines
444 B
C
#ifndef __COLOR_H__
|
|
#define __COLOR_H__ 1
|
|
|
|
enum color_attr {
|
|
COLOR_IFNAME,
|
|
COLOR_MAC,
|
|
COLOR_INET,
|
|
COLOR_INET6,
|
|
COLOR_OPERSTATE_UP,
|
|
COLOR_OPERSTATE_DOWN,
|
|
COLOR_CLEAR
|
|
};
|
|
|
|
void enable_color(void);
|
|
void check_if_color_enabled(void);
|
|
void set_color_palette(void);
|
|
int color_fprintf(FILE *fp, enum color_attr attr, const char *fmt, ...);
|
|
enum color_attr ifa_family_color(__u8 ifa_family);
|
|
enum color_attr oper_state_color(__u8 state);
|
|
|
|
#endif
|