[Spice-devel] [PATCH vd_agent_linux 3/7] file-xfers: Allocate file_path after disk space check

Frediano Ziglio fziglio at redhat.com
Tue Jan 15 18:49:58 UTC 2019


Variable is not used. Keep code to create file together.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 src/vdagent/file-xfers.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/vdagent/file-xfers.c b/src/vdagent/file-xfers.c
index 67bad9e..77029e7 100644
--- a/src/vdagent/file-xfers.c
+++ b/src/vdagent/file-xfers.c
@@ -202,8 +202,6 @@ void vdagent_file_xfers_start(struct vdagent_file_xfers *xfers,
 
     task->debug = xfers->debug;
 
-    file_path = g_build_filename(xfers->save_dir, task->file_name, NULL);
-
     free_space = get_free_space_available(xfers->save_dir);
     if (task->file_size > free_space) {
         gchar *free_space_str, *file_size_str;
@@ -223,6 +221,7 @@ void vdagent_file_xfers_start(struct vdagent_file_xfers *xfers,
         goto cleanup;
     }
 
+    file_path = g_build_filename(xfers->save_dir, task->file_name, NULL);
     dir = g_path_get_dirname(file_path);
     if (g_mkdir_with_parents(dir, S_IRWXU) == -1) {
         syslog(LOG_ERR, "file-xfer: Failed to create dir %s", dir);
-- 
2.20.1



More information about the Spice-devel mailing list