Author: pepeto Date: Fri Oct 24 18:20:20 2014 New Revision: 26843 URL: http://svn.gna.org/viewcvs/freeciv?rev=26843&view=rev Log: When configured with HAVE_GETLINE and !HAVE_LIBREADLINE, make user empty line not ignoring the standard input stream.
Reported by Marko Lindqvist <cazfi> See gna bug #18254 Modified: branches/S2_4/server/sernet.c Modified: branches/S2_4/server/sernet.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_4/server/sernet.c?rev=26843&r1=26842&r2=26843&view=diff ============================================================================== --- branches/S2_4/server/sernet.c (original) +++ branches/S2_4/server/sernet.c Fri Oct 24 18:20:20 2014 @@ -812,12 +812,13 @@ buffer = malloc(BUF_SIZE + 1); didget = read(0, buffer, BUF_SIZE); + if (didget > 0) { + buffer[didget] = '\0'; + } else { + didget = -1; /* error or end-of-file: closing stdin... */ + } +#endif /* HAVE_GETLINE */ if (didget < 0) { - didget = 0; /* Avoid buffer underrun below. */ - } - *(buffer+didget)='\0'; -#endif /* HAVE_GETLINE */ - if (didget <= 0) { handle_stdin_close(); } _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits