* libmisc/loginprompt.c: Use exit(EXIT_FAILURE) instead of

exit(1).
	* libmisc/loginprompt.c: Avoid implicit conversion of pointers to
	booleans.
	* libmisc/loginprompt.c: Ignore return value of putc().
This commit is contained in:
nekral-guest 2009-04-23 17:34:46 +00:00
parent 61ebff6d97
commit 956d68c870
2 changed files with 14 additions and 6 deletions

View File

@ -1,3 +1,11 @@
2009-04-22 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/loginprompt.c: Use exit(EXIT_FAILURE) instead of
exit(1).
* libmisc/loginprompt.c: Avoid implicit conversion of pointers to
booleans.
* libmisc/loginprompt.c: Ignore return value of putc().
2009-04-22 Nicolas François <nicolas.francois@centraliens.net> 2009-04-22 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/env.c, libmisc/age.c: Added splint annotations. * libmisc/env.c, libmisc/age.c: Added splint annotations.

View File

@ -2,7 +2,7 @@
* Copyright (c) 1989 - 1993, Julianne Frances Haugh * Copyright (c) 1989 - 1993, Julianne Frances Haugh
* Copyright (c) 1996 - 2000, Marek Michałkiewicz * Copyright (c) 1996 - 2000, Marek Michałkiewicz
* Copyright (c) 2003 - 2005, Tomasz Kłoczko * Copyright (c) 2003 - 2005, Tomasz Kłoczko
* Copyright (c) 2008 , Nicolas François * Copyright (c) 2008 - 2009, Nicolas François
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -43,7 +43,7 @@
static void login_exit (unused int sig) static void login_exit (unused int sig)
{ {
exit (1); exit (EXIT_FAILURE);
} }
/* /*
@ -86,13 +86,13 @@ void login_prompt (const char *prompt, char *name, int namesize)
* be displayed and display it before the prompt. * be displayed and display it before the prompt.
*/ */
if (prompt) { if (NULL != prompt) {
cp = getdef_str ("ISSUE_FILE"); cp = getdef_str ("ISSUE_FILE");
if (NULL != cp) { if (NULL != cp) {
fp = fopen (cp, "r"); fp = fopen (cp, "r");
if (NULL != fp) { if (NULL != fp) {
while ((i = getc (fp)) != EOF) { while ((i = getc (fp)) != EOF) {
putc (i, stdout); (void) putc (i, stdout);
} }
(void) fclose (fp); (void) fclose (fp);
@ -110,12 +110,12 @@ void login_prompt (const char *prompt, char *name, int namesize)
memzero (buf, sizeof buf); memzero (buf, sizeof buf);
if (fgets (buf, (int) sizeof buf, stdin) != buf) { if (fgets (buf, (int) sizeof buf, stdin) != buf) {
exit (1); exit (EXIT_FAILURE);
} }
cp = strchr (buf, '\n'); cp = strchr (buf, '\n');
if (NULL == cp) { if (NULL == cp) {
exit (1); exit (EXIT_FAILURE);
} }
*cp = '\0'; /* remove \n [ must be there ] */ *cp = '\0'; /* remove \n [ must be there ] */