summaryrefslogtreecommitdiff
path: root/src/motd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/motd.c')
-rw-r--r--src/motd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/motd.c b/src/motd.c
index 138b9b3..63b8f43 100644
--- a/src/motd.c
+++ b/src/motd.c
@@ -103,7 +103,7 @@ motd_cache(struct Motd *motd)
struct MotdCache *cache = NULL;
struct stat sb;
char line[MOTD_LINESIZE + 2]; /* \r\n */
- char *tmp = line;
+ char *tmp = NULL;
unsigned int i = 0;
dlink_node *ptr = NULL;
@@ -152,7 +152,7 @@ motd_cache(struct Motd *motd)
while (cache->count < cache->maxcount && fgets(line, sizeof(line), file))
{
/* copy over line, stopping when we overflow or hit line end */
- for (; i < (MOTD_LINESIZE - 1) && *tmp && *tmp != '\r' && *tmp != '\n'; ++tmp, ++i)
+ for (tmp = line, i = 0; i < (MOTD_LINESIZE - 1) && *tmp && *tmp != '\r' && *tmp != '\n'; ++tmp, ++i)
cache->motd[cache->count][i] = *tmp;
cache->motd[cache->count][i] = '\0';