Ensure that fwrite() behaves correctly even when the stream is read-only. Reviewed-by: Carlos O'Donell <carlos@redhat.com>