[libvirt] [PATCH] util: ensure safe{read, write, zero} return is checked

Eric Blake eblake at redhat.com
Wed Mar 3 18:10:09 UTC 2010

According to Eric Blake on 3/2/2010 9:40 AM:
> Based on a warning from coverity.  The safe* functions
> guarantee complete transactions on success, but don't guarantee
> freedom from failure.
> * src/util/util.h (saferead, safewrite, safezero): Add
> * src/remote/remote_driver.c (remoteIO, remoteIOEventLoop): Ignore
> some failures.
> (remoteIOReadBuffer): Adjust error messages on read failure.
> * daemon/event.c (virEventHandleWakeup): Ignore read failure.

This patch can probably wait till after 0.7.7.  Meanwhile,

> -                    saferead(priv->errfd, errout, sizeof(errout));
> +                    if (saferead(priv->errfd, errout, sizeof(errout)) < 0) {
> +                        strncpy (errout, _("unknown reason"), sizeof errout);

I obviously failed to run 'make syntax-check'.  I'll have to send a respin
of this patch with better fix that avoids strncpy.

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/20100303/bd00ea1d/attachment-0001.sig>

More information about the libvir-list mailing list