Fix treatment of EOF from player

Commit 79407e68 (v4.3.11) changed recvclient() to keep failing after
receiving EOF from player.  This was bad, because some places getting
input check player->aborted instead of recvclient() failure, and
player->aborted wasn't set on EOF.  Bugs caused by this:

* comm_bomb(), ship_bomb(), plane_bomb(), land_bomb() went into an
  infinite loop that eventually ate all memory.

* deli(), desi(), dist(), fly(), morale(), zdon(), att_prompt(),
  ask_move_in() interpreted EOF as empty input instead of no more
  input.

* cmd_sail_ship() dereferenced a null pointer.

Fix by setting player->aborted on EOF, too.
This commit is contained in:
Markus Armbruster 2008-07-14 22:37:02 -04:00
parent 9c5854c8c9
commit b3a7a8ee11
3 changed files with 8 additions and 7 deletions

View file

@ -76,7 +76,7 @@ struct player {
int simulation; /* e.g. budget command */
double dolcost;
time_t curup; /* when last input was received */
int aborted; /* interrupt cookie received? */
int aborted; /* interrupt cookie or EOF received? */
int eof; /* EOF (cookie or real) received? */
int recvfail; /* #recvclient() failures */
int curid; /* for pr, cur. line's id, -1 none */