[Spice-devel] [vdagent-linux 3/3] Disable file xfer when no suitable destination dir

Christophe Fergeau cfergeau at redhat.com
Tue Apr 1 07:24:31 PDT 2014


Currently, if no suitable destination directory can be found, the file
transfer code defaults to using '.' as the destination directory. As this
is unlikely to work, better to just disable file transfers when we end up
in such a situation. This currently happens when spawning spice-vdagent
from gdm where we don't want file transfers to be available anyway.
---
 src/vdagent.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/vdagent.c b/src/vdagent.c
index 3ab2352..50498ef 100644
--- a/src/vdagent.c
+++ b/src/vdagent.c
@@ -275,13 +275,14 @@ reconnect:
         fx_dir = g_get_user_special_dir(G_USER_DIRECTORY_DESKTOP);
     else if (!strcmp(fx_dir, "xdg-download"))
         fx_dir = g_get_user_special_dir(G_USER_DIRECTORY_DOWNLOAD);
-    if (!fx_dir) {
+    if (fx_dir) {
+        vdagent_file_xfers = vdagent_file_xfers_create(client, fx_dir,
+                                                       fx_open_dir, debug);
+    } else {
         syslog(LOG_WARNING,
-               "warning could not get file xfer save dir, using cwd");
-        fx_dir = ".";
+               "warning could not get file xfer save dir, file transfers will be disabled");
+        vdagent_file_xfers = NULL;
     }
-    vdagent_file_xfers = vdagent_file_xfers_create(client, fx_dir,
-                                                   fx_open_dir, debug);
 
     while (client && !quit) {
         FD_ZERO(&readfds);
-- 
1.9.0



More information about the Spice-devel mailing list