Commit 7c32549e by Jerry DeLisle

re PR fortran/67367 (Program crashes on READ(IOSTAT=IOS, ...) on directory OPEN()ed without error)

2015-08-29 Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/67367
	* io/unix.c (buf_read): Check for error condition and if found
	return the error code.

From-SVN: r227320
parent 4879fba9
2015-08-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/67367
* io/unix.c (buf_read): Check for error condition and if found
return the error code.
2015-08-29 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
* acinclude.m4: Remove LIBGFOR_CHECK_ATTRIBUTE_DLLEXPORT.
......
......@@ -518,17 +518,27 @@ buf_read (unix_stream * s, void * buf, ssize_t nbyte)
if (to_read <= BUFFER_SIZE/2)
{
did_read = raw_read (s, s->buffer, BUFFER_SIZE);
if (likely (did_read >= 0))
{
s->physical_offset += did_read;
s->active = did_read;
did_read = (did_read > to_read) ? to_read : did_read;
memcpy (p, s->buffer, did_read);
}
else
return did_read;
}
else
{
did_read = raw_read (s, p, to_read);
if (likely (did_read >= 0))
{
s->physical_offset += did_read;
s->active = 0;
}
else
return did_read;
}
nbyte = did_read + nread;
}
s->logical_offset += nbyte;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment