[libvirt] [PATCHv5 21/28] util: storage: Make virStorageFileChainLookup more network storage aware

Eric Blake eblake at redhat.com
Tue Jul 8 23:21:28 UTC 2014


On 07/04/2014 05:29 AM, Peter Krempa wrote:
> Add a few checks and avoid resolving relative links on networked
> storage.
> ---
>  src/util/virstoragefile.c | 27 +++++++++++++++------------
>  1 file changed, 15 insertions(+), 12 deletions(-)
> 

> +
> +            if (nameIsFile && virStorageSourceIsLocalStorage(chain)) {
> +                if (prev && virStorageSourceIsLocalStorage(prev))
> +                    parentDir = mdir_name(prev->path);
> +                else
> +                    ignore_value(VIR_STRDUP(parentDir, "."));

This reports OOM...

> +
> +                if (!parentDir) {
> +                    virReportOOMError();

...and this does it again.  If you are going to ignore_value, you
probably want VIR_STRDUP_QUIET on the earlier instance.  Otherwise, the
pre-patch code had better control over when to report OOM without doing
it twice.

> +                    goto error;
>                  }
> 
> +
>                  int result = virFileRelLinkPointsTo(parentDir, name,

Spurious newline addition?

ACK with OOM reporting cleaned up.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140708/3b3a1151/attachment-0001.sig>


More information about the libvir-list mailing list