changeset 1875:bfa92efd814b

Make missing homedir non-fatal, instead use / Fixes github #146
author Matt Johnston <matt@ucc.asn.au>
date Thu, 24 Feb 2022 11:51:51 +0800
parents 1c9215154d4a
children bfd0f3248df3 4c1560627693 fc4c9ef61856
files svr-chansession.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/svr-chansession.c	Thu Feb 03 22:13:06 2022 +0800
+++ b/svr-chansession.c	Thu Feb 24 11:51:51 2022 +0800
@@ -1033,9 +1033,14 @@
 
 	/* change directory */
 	if (chdir(ses.authstate.pw_dir) < 0) {
-		dropbear_exit("Error changing directory");
+		int e = errno;
+		if (chdir("/") < 0) {
+			dropbear_exit("chdir(\"/\") failed");
+		}
+		fprintf(stderr, "Failed chdir '%s': %s\n", ses.authstate.pw_dir, strerror(e));
 	}
 
+
 #if DROPBEAR_X11FWD
 	/* set up X11 forwarding if enabled */
 	x11setauth(chansess);