Mail Archives: djgpp-workers/1996/06/12/11:54:12
I made some modifications to my last flsbuf.c to fix the bug and btw
found a little hole in Eli's patch (see below). I have not yet tested
my new version, I'll post my patch when I'll do it.
! if ((base = f->_base) == NULL && (f->_flag & _IONBF) == 0)
! {
! size = _go32_info_block.size_of_transfer_buffer;
! if ((f->_base = base = malloc (size)) == NULL)
! f->_flag |= _IONBF;
^^^ no buffer, the code under &_IOLBF can still crash
! else
! {
! f->_flag |= _IOMYBUF;
! f->_bufsiz = size;
! if (f == stdout && isatty (fileno (stdout)))
! f->_flag |= _IOLBF;
! else
! rn = n = 0;
!
! f->_ptr = base;
! f->_cnt = f->_bufsiz;
! }
! }
!
if (f->_flag&_IOLBF)
{
base = f->_base;
- Raw text -