init: Fix segfault when log_write() was missing an arg to format.
Also, flag log_write() as a printf-like beast to gcc. Signed-off-by: Dima Zavin <dima@android.com>
This commit is contained in:
parent
feb3d6d8db
commit
770354d7e6
2 changed files with 3 additions and 2 deletions
|
|
@ -421,7 +421,7 @@ static void msg_stop(const char *name)
|
||||||
if (svc) {
|
if (svc) {
|
||||||
service_stop(svc);
|
service_stop(svc);
|
||||||
} else {
|
} else {
|
||||||
ERROR("no such service '%s'\n");
|
ERROR("no such service '%s'\n", name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,8 @@ void *read_file(const char *fn, unsigned *_sz);
|
||||||
void log_init(void);
|
void log_init(void);
|
||||||
void log_set_level(int level);
|
void log_set_level(int level);
|
||||||
void log_close(void);
|
void log_close(void);
|
||||||
void log_write(int level, const char *fmt, ...);
|
void log_write(int level, const char *fmt, ...)
|
||||||
|
__attribute__ ((format(printf, 2, 3)));
|
||||||
|
|
||||||
#define ERROR(x...) log_write(3, "<3>init: " x)
|
#define ERROR(x...) log_write(3, "<3>init: " x)
|
||||||
#define NOTICE(x...) log_write(5, "<5>init: " x)
|
#define NOTICE(x...) log_write(5, "<5>init: " x)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue