[libvirt] [PATCH] Fix safezero()
Eric Blake
eblake at redhat.com
Tue Mar 2 15:27:34 UTC 2010
According to Jiri Denemark on 3/2/2010 8:11 AM:
> Various safezero() implementations used either -1, errno or -errno
> return values. This patch fixes them all to return -1 and set errno
> appropriately.
Correct move, to match the semantics of the HAVE_POSIX_FALLOCATE version.
>
> There was also a bug in size parameter passed to safewrite() which could
> result in an attempt to write gigabytes out of a megabyte buffer.
Good catch, since len is off_t.
> while (remain) {
> if (bytes > remain)
> bytes = remain;
>
> - r = safewrite(fd, buf, len);
> + r = safewrite(fd, buf, bytes);
ACK.
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 320 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100302/916d4d81/attachment-0001.sig>
More information about the libvir-list
mailing list