return -1;
}
+ if (abfd->last_io == bfd_io_write)
+ {
+ abfd->last_io = bfd_io_force;
+ if (bfd_seek (abfd, 0, SEEK_CUR) != 0)
+ return -1;
+ }
+ abfd->last_io = bfd_io_read;
+
nread = abfd->iovec->bread (abfd, ptr, size);
if (nread != -1)
abfd->where += nread;
return -1;
}
+ if (abfd->last_io == bfd_io_read)
+ {
+ abfd->last_io = bfd_io_force;
+ if (bfd_seek (abfd, 0, SEEK_CUR) != 0)
+ return -1;
+ }
+ abfd->last_io = bfd_io_write;
+
nwrote = abfd->iovec->bwrite (abfd, ptr, size);
if (nwrote != -1)
abfd->where += nwrote;
if (direction != SEEK_CUR)
position += offset;
+ if (((direction == SEEK_CUR && position == 0)
+ || (direction == SEEK_SET && (ufile_ptr) position == abfd->where))
+ && abfd->last_io != bfd_io_force)
+ return 0;
+
+ abfd->last_io = bfd_io_seek;
+
result = abfd->iovec->bseek (abfd, position, direction);
if (result != 0)
{