login: fix /etc/nologin support

build system: fix config warnings ("Overlong line")

function                                             old     new   delta
login_main                                          1735    1774     +39
__libc_tcdrain                                         -      23     +23
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 62/0)               Total: 62 bytes
This commit is contained in:
Denis Vlasenko 2008-11-07 01:12:16 +00:00
parent 239d06bd47
commit 694b514148
2 changed files with 26 additions and 14 deletions

View File

@ -118,18 +118,25 @@ static void die_if_nologin(void)
{ {
FILE *fp; FILE *fp;
int c; int c;
int empty = 1;
if (access("/etc/nologin", F_OK))
return;
fp = fopen_for_read("/etc/nologin"); fp = fopen_for_read("/etc/nologin");
if (fp) { if (!fp) /* assuming it does not exist */
while ((c = getc(fp)) != EOF) return;
bb_putchar((c=='\n') ? '\r' : c);
fflush(stdout); while ((c = getc(fp)) != EOF) {
fclose(fp); if (c == '\n')
} else bb_putchar('\r');
bb_putchar(c);
empty = 0;
}
if (empty)
puts("\r\nSystem closed for routine maintenance\r"); puts("\r\nSystem closed for routine maintenance\r");
fclose(fp);
fflush(NULL);
/* Users say that they do need this prior to exit: */
tcdrain(STDOUT_FILENO);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
#else #else

View File

@ -17,15 +17,18 @@ config POPMAILDIR
bool "popmaildir" bool "popmaildir"
default n default n
help help
Simple yet powerful POP3 mail popper. Delivers content of remote mailboxes to local Maildir. Simple yet powerful POP3 mail popper. Delivers content
of remote mailboxes to local Maildir.
config FEATURE_POPMAILDIR_DELIVERY config FEATURE_POPMAILDIR_DELIVERY
bool "Allow message filters and custom delivery program" bool "Allow message filters and custom delivery program"
default n default n
depends on POPMAILDIR depends on POPMAILDIR
help help
Allow to use a custom program to filter the content of the message before actual delivery (-F "prog [args...]"). Allow to use a custom program to filter the content
Allow to use a custom program for message actual delivery (-M "prog [args...]"). of the message before actual delivery (-F "prog [args...]").
Allow to use a custom program for message actual delivery
(-M "prog [args...]").
config REFORMIME config REFORMIME
bool "reformime" bool "reformime"
@ -38,7 +41,8 @@ config FEATURE_REFORMIME_COMPAT
default y default y
depends on REFORMIME depends on REFORMIME
help help
Accept (for compatibility only) and ignore options other than -x and -X. Accept (for compatibility only) and ignore options
other than -x and -X.
config SENDMAIL config SENDMAIL
bool "sendmail" bool "sendmail"
@ -59,6 +63,7 @@ config FEATURE_SENDMAIL_MAILXX
default n default n
depends on FEATURE_SENDMAIL_MAILX depends on FEATURE_SENDMAIL_MAILX
help help
Allow to specify Cc: addresses and some additional headers: Errors-To:. Allow to specify Cc: addresses and some additional headers:
Errors-To:
endmenu endmenu