Set zero size only when nothing is written
Set zero size only when nothing is written

There is a bug where is_zero_size is set when the loop is exited,
regardless of whether any data was written in the while loop, making it
seems like 0 bytes were written.

We need to differentiate an exit with no data written and and exit with,
so we test if anything was actually written and only set is_zero_size
when nothing has been written.

Also, bytes_read gets resetted to 0 with the next line seek(0), so we
check before resetting the file position.

Change-Id: I547bdefe88816db85b5ff510e997980269eac1f7

openstack/glance_store,openstack/glance_store