2008-03-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/35699
* io/transfer.c (write_buf): Don't pad the record, just return if the
data is NULL. (next_record_w): If there are bytes left in the record
for unformatted direct I/O, pad out the record with zero bytes.
From-SVN: r133699
+2008-03-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libfortran/35699
+ * io/transfer.c (write_buf): Don't pad the record, just return if the
+ data is NULL. (next_record_w): If there are bytes left in the record
+ for unformatted direct I/O, pad out the record with zero bytes.
+
2008-03-28 Tobias Burnus <burnus@net-b.de>
PR fortran/35721
}
if (buf == NULL && nbytes == 0)
- {
- char *p;
- p = write_block (dtp, dtp->u.p.current_unit->recl);
- memset (p, 0, dtp->u.p.current_unit->recl);
- return SUCCESS;
- }
+ return SUCCESS;
if (swrite (dtp->u.p.current_unit->s, buf, &nbytes) != 0)
{
break;
case UNFORMATTED_DIRECT:
+ if (dtp->u.p.current_unit->bytes_left > 0)
+ {
+ length = (int) dtp->u.p.current_unit->bytes_left;
+ p = salloc_w (dtp->u.p.current_unit->s, &length);
+ memset (p, 0, length);
+ }
+
if (sfree (dtp->u.p.current_unit->s) == FAILURE)
goto io_error;
break;