Signed-off-by: Alejandro Colomar <alx@kernel.org>
#include "defines.h"
#include "getdef.h"
#include "prototypes.h"
-#include "string/strdup/xstrdup.h"
/*
* it to the user's terminal at login time. The MOTD_FILE configuration
* option is a colon-delimited list of filenames.
*/
-void
+int
motd(void)
{
FILE *fp;
int c;
motdfile = getdef_str ("MOTD_FILE");
- if (NULL == motdfile) {
- return;
- }
+ if (NULL == motdfile)
+ return 0;
- motdlist = xstrdup (motdfile);
+ motdlist = strdup(motdfile);
+ if (motdlist == NULL)
+ return -1;
mb = motdlist;
while (NULL != (motdfile = strsep(&mb, ":"))) {
fflush (stdout);
free (motdlist);
+ return 0;
}
extern void mailcheck (void);
/* motd.c */
-extern void motd (void);
+extern int motd(void);
/* myname.c */
extern /*@null@*//*@only@*/struct passwd *get_my_pwent (void);
#include <pwd.h>
#include <signal.h>
#include <stdio.h>
+#include <stdlib.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <assert.h>
* this
*/
#ifndef USE_PAM
- motd (); /* print the message of the day */
+ if (motd() == -1)
+ exit(EXIT_FAILURE);
+
if ( getdef_bool ("FAILLOG_ENAB")
&& (0 != faillog.fail_cnt)) {
failprint (&faillog);