Commit 6163828e authored by Christophe Fergeau's avatar Christophe Fergeau
Browse files

webdav: Cope with NULL SpiceSession::shared-dir

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
parent d6ec4db2
......@@ -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);
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment