diff options
-rw-r--r-- | unix/vncserver/vncsession.c | 10 | ||||
-rw-r--r-- | vncviewer/vncviewer.cxx | 4 |
2 files changed, 10 insertions, 4 deletions
diff --git a/unix/vncserver/vncsession.c b/unix/vncserver/vncsession.c index 0830e81a..79683ff9 100644 --- a/unix/vncserver/vncsession.c +++ b/unix/vncserver/vncsession.c @@ -134,7 +134,7 @@ begin_daemon(void) static void finish_daemon(void) { - write(daemon_pipe_fd, "+", 1); + if (write(daemon_pipe_fd, "+", 1) == -1) {} close(daemon_pipe_fd); daemon_pipe_fd = -1; } @@ -545,8 +545,12 @@ run_script(const char *username, const char *display, char **envp) switch_user(pwent->pw_name, pwent->pw_uid, pwent->pw_gid); - if (chdir(pwent->pw_dir) == -1) - chdir("/"); + if (chdir(pwent->pw_dir) == -1) { + syslog(LOG_CRIT, "chdir(\"%s\") failed: %s", pwent->pw_dir, strerror(errno)); + // fallback to "/" + if (chdir("/") == -1) + syslog(LOG_CRIT, "chdir(\"%s\") failed: %s", "/", strerror(errno)); + } close_fds(); diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx index 29cf4ca0..3db9bd64 100644 --- a/vncviewer/vncviewer.cxx +++ b/vncviewer/vncviewer.cxx @@ -607,7 +607,9 @@ createTunnel(const char *gatewayHost, const char *remoteHost, cmd2 = strdup(cmd); while ((percent = strchr(cmd2, '%')) != nullptr) *percent = '$'; - system(cmd2); + int res = system(cmd2); + if (res != 0) + fprintf(stderr, "Failed to create tunnel: '%s' returned %d\n", cmd2, res); free(cmd2); } |