Re: [spice-gtk 1/2] webdav: Cope with NULL SpiceSession::shared-dir

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ack

----- Original Message -----
> shared-dir default value is
> g_get_user_special_dir(G_USER_DIRECTORY_PUBLIC_SHARE)
> which can be NULL (for example if ~/.config/user-dirs.dirs does not
> exist).
> This commit makes sure we don't create a PhodavServer when this occurs
> ---
>  gtk/channel-webdav.c | 9 ++++++++-
>  gtk/spice-session.c  | 4 +++-
>  2 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/gtk/channel-webdav.c b/gtk/channel-webdav.c
> index 94f3ef3..bce46fa 100644
> --- a/gtk/channel-webdav.c
> +++ b/gtk/channel-webdav.c
> @@ -700,8 +700,15 @@ PhodavServer* channel_webdav_server_new(SpiceSession
> *session)
>      PhodavServer *dav;
>      SoupServer *server;
>      SoupSocket *listener;
> +    const char *shared_dir;
>  
> -    dav = phodav_server_new(0, spice_session_get_shared_dir(session));
> +    shared_dir = spice_session_get_shared_dir(session);
> +    if (shared_dir != NULL) {
> +        g_debug("No shared dir set, not creating webdav channel");
> +        return NULL;
> +    }
> +
> +    dav = phodav_server_new(0, shared_dir);
>  
>      server = phodav_server_get_soup_server(dav);
>      listener = soup_server_get_listener(server);
> diff --git a/gtk/spice-session.c b/gtk/spice-session.c
> index a62d533..059cd2f 100644
> --- a/gtk/spice-session.c
> +++ b/gtk/spice-session.c
> @@ -2626,7 +2626,9 @@ PhodavServer*
> spice_session_get_webdav_server(SpiceSession *session)
>              session->priv->webdav_magic[i] = g_random_int_range(0, 255);
>  
>          session->priv->webdav = channel_webdav_server_new(session);
> -        phodav_server_run(session->priv->webdav);
> +        if (session->priv->webdav != NULL) {
> +            phodav_server_run(session->priv->webdav);
> +        }
>      }
>      g_static_mutex_unlock(&mutex);
>  #endif
> --
> 2.1.0
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]