Don't fail motd command when motdfil can't be read

Not the player's business.  Simply treat it as no MOTD.
This commit is contained in:
Markus Armbruster 2009-02-07 20:12:12 +01:00
parent f465b1e1e2
commit 1dba1fccee

View file

@ -265,25 +265,24 @@ show_motd(void)
if (errno == ENOENT) if (errno == ENOENT)
return RET_OK; return RET_OK;
else { else {
pr ("Could not open motd.\n");
logerror("Could not open motd (%s).\n", motdfil); logerror("Could not open motd (%s).\n", motdfil);
return RET_FAIL; return RET_OK;
} }
} }
if (fread(&tgm, sizeof(tgm), 1, motd_fp) != 1) { if (fread(&tgm, sizeof(tgm), 1, motd_fp) != 1) {
logerror("bad header on login message (motdfil)"); logerror("bad header on login message (motdfil)");
fclose(motd_fp); fclose(motd_fp);
return RET_FAIL; return RET_OK;
} }
if (tgm.tel_length >= (long)sizeof(buf)) { if (tgm.tel_length >= (long)sizeof(buf)) {
logerror("text length (%ld) is too long for login message (motdfil)", tgm.tel_length); logerror("text length (%ld) is too long for login message (motdfil)", tgm.tel_length);
fclose(motd_fp); fclose(motd_fp);
return RET_FAIL; return RET_OK;
} }
if (fread(buf, tgm.tel_length, 1, motd_fp) != 1) { if (fread(buf, tgm.tel_length, 1, motd_fp) != 1) {
logerror("bad length %ld on login message", tgm.tel_length); logerror("bad length %ld on login message", tgm.tel_length);
fclose(motd_fp); fclose(motd_fp);
return RET_FAIL; return RET_OK;
} }
buf[tgm.tel_length] = 0; buf[tgm.tel_length] = 0;
uprnf(buf); uprnf(buf);