[Spice-devel] oVirt support in aSPICE stalled due to broken network file I/O

Christophe Fergeau cfergeau at redhat.com
Mon Sep 16 00:49:29 PDT 2013


Hey Iordan,

On Sun, Sep 15, 2013 at 02:13:05PM -0400, i iordanov wrote:
> Hi Christophe,
> 
> I've tested the function and made one small change (bytes had to be
> unref-ed before ca_file). This works for my purposes and solves my
> issue of not being able to download the file using glib network I/O.
> Would you be willing to include it in govirt? Notice that it
> automatically uses set_downloaded_ca_cert() to set the ca property of
> OvirtProxy.

> 
> void ovirt_proxy_load_ca_cert_file (OvirtProxy *proxy,
>                                     const gchar *ca_file_name,
>                                     GError **error)
> {
>     GMappedFile *ca_file = NULL;
>     GBytes *bytes = NULL;
>     gconstpointer ca_data;
>     gsize cert_length = 0;
> 
>     ca_file = g_mapped_file_new(ca_file_name, FALSE, error);
>     if (ca_file == NULL) {
>         goto error;
>     }
> 
>     bytes = g_mapped_file_get_bytes(ca_file);
>     cert_length = g_bytes_get_size(bytes);
>     ca_data = g_bytes_get_data (bytes, &cert_length);

I think this can be done more simply using
g_file_get_contents() rather than using a GMappedFile.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20130916/037d8e38/attachment.pgp>


More information about the Spice-devel mailing list