if bfd_write is invoked with ptr == NULL and (size * nitems) == 0, don't bother calling fwrite(); just return (0)

This commit is contained in:
lukem 1999-09-17 13:38:19 +00:00
parent 0f075b205f
commit 8b94063948
1 changed files with 2 additions and 0 deletions

View File

@ -526,6 +526,8 @@ bfd_write (ptr, size, nitems, abfd)
if ((abfd->flags & BFD_IN_MEMORY) != 0)
abort ();
if (ptr == 0 && size * nitems == 0)
return (0);
nwrote = fwrite (ptr, 1, (size_t) (size * nitems),
bfd_cache_lookup (abfd));
if (nwrote > 0)