mirror of
https://github.com/paxed/dgamelaunch.git
synced 2025-07-29 16:45:35 +02:00
Give a message when the max number of users has been reached, avoiding the
creation of a too large user list. If the list was not too large when selecting the 'r' option, but is after all data has been entered, bail out without message and corrupting the terminal settings (oops). git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@142 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
parent
95c2eed65e
commit
390c2666cd
@ -865,6 +865,20 @@ newuser ()
|
||||
|
||||
loggedin = 0;
|
||||
|
||||
if (f_num >= myconfig->max)
|
||||
{
|
||||
clear ();
|
||||
|
||||
drawbanner (1, 1);
|
||||
|
||||
mvaddstr (5, 1, "Sorry, too many users have registered now.");
|
||||
mvaddstr (6, 1, "You might email the server administrator.");
|
||||
mvaddstr (7, 1, "Press return to return to the menu. ");
|
||||
getch ();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (me)
|
||||
free (me);
|
||||
|
||||
@ -1077,7 +1091,7 @@ readfile (int nolock)
|
||||
|
||||
f_num++;
|
||||
/* prevent a buffer overrun here */
|
||||
if (f_num >= myconfig->max)
|
||||
if (f_num > myconfig->max)
|
||||
graceful_exit (109);
|
||||
}
|
||||
|
||||
@ -1230,8 +1244,11 @@ writefile (int requirenew)
|
||||
}
|
||||
if (loggedin && !my_done)
|
||||
{ /* new entry */
|
||||
if (f_num < myconfig->max)
|
||||
fprintf (fp, "%s:%s:%s:%s\n", me->username, me->email, me->password,
|
||||
me->env);
|
||||
else /* Oops, someone else registered the last available slot first */
|
||||
graceful_exit (116);
|
||||
}
|
||||
|
||||
fcntl (fileno (fpl), F_UNLCK, &fl);
|
||||
|
Loading…
x
Reference in New Issue
Block a user