File xrdp-Don-t-try-to-create-.vnc-directory-if-it-exists.patch of Package xrdp.29105

From e9d064e3909a437d2d5380e3b2f42a4dcabd8711 Mon Sep 17 00:00:00 2001
From: Pavel Roskin <plroskin@gmail.com>
Date: Sun, 6 Nov 2016 22:06:24 -0800
Subject: [PATCH] Don't try to create .vnc directory if it exists

Report system error if it cannot be created.

Index: xrdp-0.9.0~git.1456906198.f422461/sesman/env.c
===================================================================
--- xrdp-0.9.0~git.1456906198.f422461.orig/sesman/env.c
+++ xrdp-0.9.0~git.1456906198.f422461/sesman/env.c
@@ -150,10 +150,14 @@ env_set_user(char *username, char *passw
                 {
                     /* if no auth_file_path is set, then we go for
                        $HOME/.vnc/sesman_username_passwd */
-                    if (g_mkdir(".vnc") < 0)
+                    if (!g_directory_exist(".vnc"))
                     {
-                        log_message(LOG_LEVEL_ERROR,
-                            "env_set_user: error creating .vnc dir");
+                        if (g_mkdir(".vnc") < 0)
+                        {
+                            log_message(LOG_LEVEL_ERROR,
+                                        "Error creating .vnc directory: %s",
+                                        g_get_strerror());
+                        }
                     }
                     g_sprintf(passwd_file, "%s/.vnc/sesman_%s_passwd", pw_dir, username);
                 }
openSUSE Build Service is sponsored by