comparison svr-chansession.c @ 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 2b3a8026a6ce
children 2839daa507b3
comparison
equal deleted inserted replaced
1874:1c9215154d4a 1875:bfa92efd814b
1031 addnewvar("SSH_ORIGINAL_COMMAND", chansess->original_command); 1031 addnewvar("SSH_ORIGINAL_COMMAND", chansess->original_command);
1032 } 1032 }
1033 1033
1034 /* change directory */ 1034 /* change directory */
1035 if (chdir(ses.authstate.pw_dir) < 0) { 1035 if (chdir(ses.authstate.pw_dir) < 0) {
1036 dropbear_exit("Error changing directory"); 1036 int e = errno;
1037 } 1037 if (chdir("/") < 0) {
1038 dropbear_exit("chdir(\"/\") failed");
1039 }
1040 fprintf(stderr, "Failed chdir '%s': %s\n", ses.authstate.pw_dir, strerror(e));
1041 }
1042
1038 1043
1039 #if DROPBEAR_X11FWD 1044 #if DROPBEAR_X11FWD
1040 /* set up X11 forwarding if enabled */ 1045 /* set up X11 forwarding if enabled */
1041 x11setauth(chansess); 1046 x11setauth(chansess);
1042 #endif 1047 #endif