ui/spice-app: detect runtime directory creation failures
spice_app_display_early_init() creates the per-VM runtime directory with g_mkdir_with_parents() before setting up the Spice socket. The code checks for "< -1", but g_mkdir_with_parents() returns -1 on failure, so the error path is never taken. This lets spice-app continue after a directory creation failure and defers the problem to later setup steps. Check for "< 0" instead so the failure is reported immediately and spice-app exits before using an invalid runtime directory. Fixes: d8aec9d9f129 ("display: add -display spice-app launching a Spice client") Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20260408031725.641417-1-zhaoguohan@kylinos.cn>
GuoHan Zhao committed
Apr 8, 2026 at 11:17 UTC
52cf667ed2285aa2d08db6abed46cdba5c14f9aa
1 file changed
+1
-1
ui/spice-app.c
+1
-1
@@ -151,7 +151,7 @@ static void spice_app_display_early_init(DisplayOptions *opts)
151
if (qemu_name) {
152
app_dir = g_build_filename(g_get_user_runtime_dir(),
153
"qemu", qemu_name, NULL);
154
- if (g_mkdir_with_parents(app_dir, S_IRWXU) < -1) {
154
+ if (g_mkdir_with_parents(app_dir, S_IRWXU) < 0) {
155
error_report("Failed to create directory %s: %s",
156
app_dir, strerror(errno));
157
exit(1);