]> source.dussan.org Git - tigervnc.git/commitdiff
Change to user's home directory before starting session
authorPierre Ossman <ossman@cendio.se>
Fri, 4 Dec 2020 13:34:43 +0000 (14:34 +0100)
committerPierre Ossman <ossman@cendio.se>
Fri, 4 Dec 2020 13:34:43 +0000 (14:34 +0100)
This is what display managers do, so it is expected by many
environments.

unix/vncserver/vncsession.c

index f78c096f7997617c56d364c78cce3935056a4251..956a8f4ba2ff707b57b56d9453033a7fbca68404 100644 (file)
@@ -431,6 +431,9 @@ 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("/");
+
     close_fds();
 
     redir_stdio(pwent->pw_dir, display);