• E
    storage: avoid short reads while chasing backing chain · 5327fad4
    Eric Blake 提交于
    Our backing file chain code was not very robust to an ill-timed
    EINTR, which could lead to a short read causing us to randomly
    treat metadata differently than usual.  But the existing
    virFileReadLimFD forces an error if we don't read the entire
    file, even though we only care about the header of the file.
    So add a new virFile function that does what we want.
    
    * src/util/virfile.h (virFileReadHeaderFD): New prototype.
    * src/util/virfile.c (virFileReadHeaderFD): New function.
    * src/libvirt_private.syms (virfile.h): Export it.
    * src/util/virstoragefile.c (virStorageFileGetMetadataInternal)
    (virStorageFileProbeFormatFromFD): Use it.
    Signed-off-by: NEric Blake <eblake@redhat.com>
    5327fad4
virfile.h 8.3 KB