diff options
author | James Byrne <james.byrne@origamienergy.com> | 2019-04-12 17:01:51 +0000 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2019-04-30 10:51:27 +0200 |
commit | 253c4e787a799a3e1f92957ed791b5222f8d2f64 (patch) | |
tree | 36204e05aaaf2cdcbd89eaadeff0193f99b063bf /loginutils | |
parent | f3a064f4956e113978e74486300dcd1e3e044efa (diff) | |
download | busybox-253c4e787a799a3e1f92957ed791b5222f8d2f64.tar.gz |
Optionally re-introduce bb_info_msg()
Between Busybox 1.24.2 and 1.25.0 the bb_info_msg() function was
eliminated and calls to it changed to be bb_error_msg(). The downside of
this is that daemons now log all messages to syslog at the LOG_ERR level
which makes it hard to filter errors from informational messages.
This change optionally re-introduces bb_info_msg(), controlled by a new
option FEATURE_SYSLOG_INFO, restores all the calls to bb_info_msg() that
were removed (only in applets that set logmode to LOGMODE_SYSLOG or
LOGMODE_BOTH), and also changes informational messages in ifplugd and
ntpd.
The code size change of this is as follows (using 'defconfig' on x86_64
with gcc 7.3.0-27ubuntu1~18.04)
function old new delta
bb_info_msg - 182 +182
bb_vinfo_msg - 27 +27
static.log7 194 198 +4
log8 190 191 +1
log5 190 191 +1
crondlog 45 - -45
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 3/0 up/down: 215/-45) Total: 170 bytes
If you don't care about everything being logged at LOG_ERR level
then when FEATURE_SYSLOG_INFO is disabled Busybox actually gets smaller:
function old new delta
static.log7 194 200 +6
log8 190 193 +3
log5 190 193 +3
syslog_level 1 - -1
bb_verror_msg 583 581 -2
crondlog 45 - -45
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 3/1 up/down: 12/-48) Total: -36 bytes
Signed-off-by: James Byrne <james.byrne@origamienergy.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'loginutils')
-rw-r--r-- | loginutils/chpasswd.c | 2 | ||||
-rw-r--r-- | loginutils/passwd.c | 2 | ||||
-rw-r--r-- | loginutils/sulogin.c | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/loginutils/chpasswd.c b/loginutils/chpasswd.c index 4b3602e7a..dd0532c66 100644 --- a/loginutils/chpasswd.c +++ b/loginutils/chpasswd.c @@ -114,7 +114,7 @@ int chpasswd_main(int argc UNUSED_PARAM, char **argv) if (rc < 0) bb_error_msg_and_die("an error occurred updating password for %s", name); if (rc) - bb_error_msg("password for '%s' changed", name); + bb_info_msg("password for '%s' changed", name); logmode = LOGMODE_STDIO; free(name); free(free_me); diff --git a/loginutils/passwd.c b/loginutils/passwd.c index 30e096460..6c643d3d0 100644 --- a/loginutils/passwd.c +++ b/loginutils/passwd.c @@ -228,7 +228,7 @@ int passwd_main(int argc UNUSED_PARAM, char **argv) /* LOGMODE_BOTH */ if (rc < 0) bb_error_msg_and_die("can't update password file %s", filename); - bb_error_msg("password for %s changed by %s", name, myname); + bb_info_msg("password for %s changed by %s", name, myname); /*if (ENABLE_FEATURE_CLEAN_UP) free(newp); - can't, it may be non-malloced */ skip: diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c index 27ea5dff0..9bb4d3613 100644 --- a/loginutils/sulogin.c +++ b/loginutils/sulogin.c @@ -68,17 +68,17 @@ int sulogin_main(int argc UNUSED_PARAM, char **argv) ); if (r < 0) { /* ^D, ^C, timeout, or read error */ - bb_error_msg("normal startup"); + bb_info_msg("normal startup"); return 0; } if (r > 0) { break; } bb_do_delay(LOGIN_FAIL_DELAY); - bb_error_msg("Login incorrect"); + bb_info_msg("Login incorrect"); } - bb_error_msg("starting shell for system maintenance"); + bb_info_msg("starting shell for system maintenance"); IF_SELINUX(renew_current_security_context()); |