aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/playerdb.c
diff options
context:
space:
mode:
Diffstat (limited to 'FICS/playerdb.c')
-rw-r--r--FICS/playerdb.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/FICS/playerdb.c b/FICS/playerdb.c
index 0c5c502..b1c3d73 100644
--- a/FICS/playerdb.c
+++ b/FICS/playerdb.c
@@ -1697,20 +1697,30 @@ write_p_inout(int inout, int p, char *file, int maxlines)
PUBLIC void
player_write_login(int p)
{
- char fname[MAX_FILENAME_SIZE];
+ char fname[MAX_FILENAME_SIZE] = { '\0' };
+ int ret;
if (parray[p].registered) {
- snprintf(fname, sizeof fname, "%s/player_data/%c/%s.%s",
+ ret = snprintf(fname, sizeof fname, "%s/player_data/%c/%s.%s",
stats_dir, parray[p].login[0], parray[p].login,
STATS_LOGONS);
- write_p_inout(P_LOGIN, p, fname, 8);
+ if (!is_too_long(ret, sizeof fname))
+ write_p_inout(P_LOGIN, p, fname, 8);
+ else
+ warnx("%s: filename too long", __func__);
}
- snprintf(fname, sizeof fname, "%s/%s", stats_dir, STATS_LOGONS);
- write_p_inout(P_LOGIN, p, fname, 30);
+ ret = snprintf(fname, sizeof fname, "%s/%s", stats_dir, STATS_LOGONS);
+ if (!is_too_long(ret, sizeof fname))
+ write_p_inout(P_LOGIN, p, fname, 30);
+ else
+ warnx("%s: filename too long", __func__);
- snprintf(fname, sizeof fname, "%s/%s", stats_dir, "logons.log");
- write_p_inout(P_LOGIN, p, fname, 0);
+ ret = snprintf(fname, sizeof fname, "%s/%s", stats_dir, "logons.log");
+ if (!is_too_long(ret, sizeof fname))
+ write_p_inout(P_LOGIN, p, fname, 0);
+ else
+ warnx("%s: filename too long", __func__);
}
PUBLIC void