summaryrefslogtreecommitdiffstats
path: root/login-utils/login.c
diff options
context:
space:
mode:
Diffstat (limited to 'login-utils/login.c')
-rw-r--r--login-utils/login.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/login-utils/login.c b/login-utils/login.c
index ff56cac4f..80d287d97 100644
--- a/login-utils/login.c
+++ b/login-utils/login.c
@@ -217,7 +217,7 @@ static const char *get_thishost(struct login_context *cxt, const char **domain)
*/
static void motd(void)
{
- char *motdlist, *motdfile, *cp;
+ char *motdlist, *motdfile;
const char *mb;
mb = getlogindefs_str("MOTD_FILE", _PATH_MOTDFILE);
@@ -226,7 +226,9 @@ static void motd(void)
motdlist = xstrdup(mb);
- for (cp = motdlist; (motdfile = strtok(cp, ":")); cp = NULL) {
+ for (motdfile = strtok(motdlist, ":"); motdfile;
+ motdfile = strtok(NULL, ":")) {
+
struct stat st;
int fd;
@@ -239,6 +241,8 @@ static void motd(void)
sendfile(fileno(stdout), fd, NULL, st.st_size);
close(fd);
}
+
+ free(motdlist);
}
/*