From 60029514a63a07bab78cbd557ccbece826d1f9a9 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Sun, 6 Nov 2016 20:31:59 -0800 Subject: [PATCH 1/2] Report system error if the VNC password file cannot be created --- sesman/env.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sesman/env.c b/sesman/env.c index 11c8e2bf..5ea4beb9 100644 --- a/sesman/env.c +++ b/sesman/env.c @@ -71,8 +71,8 @@ env_check_password_file(const char *filename, const char *passwd) if (fd == -1) { log_message(LOG_LEVEL_WARNING, - "can't write vnc password hash file - %s", - filename); + "Cannot write VNC password hash to file %s: %s", + filename, g_get_strerror()); return 1; } g_file_write(fd, encryptedPasswd, 8); From e9d064e3909a437d2d5380e3b2f42a4dcabd8711 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Sun, 6 Nov 2016 22:06:24 -0800 Subject: [PATCH 2/2] Don't try to create .vnc directory if it exists Report system error if it cannot be created. --- sesman/env.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sesman/env.c b/sesman/env.c index 5ea4beb9..1a4fa679 100644 --- a/sesman/env.c +++ b/sesman/env.c @@ -151,10 +151,14 @@ env_set_user(const char *username, char **passwd_file, int display, { /* 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()); + } } len = g_snprintf(NULL, 0, "%s/.vnc/sesman_%s_passwd", pw_dir, username);