Make non-interactive reading more robust.

darcs-hash:20051216155010-ac50b-8237935c6e95c296fd67280b1879267f9e7a949b.gz
This commit is contained in:
axel 2005-12-17 01:50:10 +10:00
parent e6bd3dbc40
commit 9229041385

View File

@ -3037,7 +3037,21 @@ static int read_ni( int fd )
while(!feof( in_stream ))
{
char buff[4096];
int c = fread(buff, 1, 4096, in_stream);
int c;
c = fread(buff, 1, 4096, in_stream);
if( ferror( in_stream ) )
{
debug( 1,
L"Error while reading commands" );
/*
Reset buffer. We won't evaluate incomplete files.
*/
acc.used=0;
break;
}
b_append( &acc, buff, c );
}
b_append( &acc, "\0", 1 );