return get;
}
- nread = abfd->iovec->bread (abfd, ptr, size);
+ if (abfd->iovec)
+ nread = abfd->iovec->bread (abfd, ptr, size);
+ else
+ nread = 0;
if (nread != (size_t) -1)
abfd->where += nread;
if ((abfd->flags & BFD_IN_MEMORY) != 0)
{
struct bfd_in_memory *bim = abfd->iostream;
+
size = (size_t) size;
if (abfd->where + size > bim->size)
{
return size;
}
- nwrote = abfd->iovec->bwrite (abfd, ptr, size);
+ if (abfd->iovec)
+ nwrote = abfd->iovec->bwrite (abfd, ptr, size);
+ else
+ nwrote = 0;
+
if (nwrote != (size_t) -1)
abfd->where += nwrote;
if (nwrote != size)
if ((abfd->flags & BFD_IN_MEMORY) != 0)
return abfd->where;
- ptr = abfd->iovec->btell (abfd);
+ if (abfd->iovec)
+ {
+ ptr = abfd->iovec->btell (abfd);
+
+ if (abfd->my_archive)
+ ptr -= abfd->origin;
+ }
+ else
+ ptr = 0;
- if (abfd->my_archive)
- ptr -= abfd->origin;
abfd->where = ptr;
return ptr;
}
{
if ((abfd->flags & BFD_IN_MEMORY) != 0)
return 0;
- return abfd->iovec->bflush (abfd);
+
+ if (abfd->iovec)
+ return abfd->iovec->bflush (abfd);
+ return 0;
}
/* Returns 0 for success, negative value for failure (in which case
if ((abfd->flags & BFD_IN_MEMORY) != 0)
abort ();
- result = abfd->iovec->bstat (abfd, statbuf);
+ if (abfd->iovec)
+ result = abfd->iovec->bstat (abfd, statbuf);
+ else
+ result = -1;
+
if (result < 0)
bfd_set_error (bfd_error_system_call);
return result;
(abfd->direction == both_direction))
{
bfd_size_type newsize, oldsize;
+
oldsize = (bim->size + 127) & ~(bfd_size_type) 127;
bim->size = abfd->where;
/* Round up to cut down on memory fragmentation */
if (direction == SEEK_SET && abfd->my_archive != NULL)
file_position += abfd->origin;
- result = abfd->iovec->bseek (abfd, file_position, direction);
+ if (abfd->iovec)
+ result = abfd->iovec->bseek (abfd, file_position, direction);
+ else
+ result = -1;
+
if (result != 0)
{
int hold_errno = errno;
if (abfd->mtime_set)
return abfd->mtime;
+ if (abfd->iovec == NULL)
+ return 0;
+
if (abfd->iovec->bstat (abfd, &buf) != 0)
return 0;
if ((abfd->flags & BFD_IN_MEMORY) != 0)
return ((struct bfd_in_memory *) abfd->iostream)->size;
+ if (abfd->iovec == NULL)
+ return 0;
+
if (abfd->iovec->bstat (abfd, &buf) != 0)
return 0;