mirror of
http://galexander.org/git/simplesshd.git
synced 2024-12-28 17:08:08 +00:00
close all the android system fds when starting the dropbear server
This commit is contained in:
parent
90e7ca14ae
commit
253c468b3a
@ -135,6 +135,7 @@ Java_org_galexander_sshd_SimpleSSHDService_start_1sshd(JNIEnv *env_,
|
||||
const char *logfn;
|
||||
int logfd;
|
||||
int retval;
|
||||
int i;
|
||||
|
||||
logfn = conf_path_file("dropbear.err");
|
||||
unlink(logfn);
|
||||
@ -143,6 +144,11 @@ Java_org_galexander_sshd_SimpleSSHDService_start_1sshd(JNIEnv *env_,
|
||||
/* replace stderr, so the output is preserved... */
|
||||
dup2(logfd, 2);
|
||||
}
|
||||
for (i = 3; i < 255; i++) {
|
||||
/* close all of the dozens of fds that android typically
|
||||
* leaves open */
|
||||
close(i);
|
||||
}
|
||||
|
||||
argv[argc++] = "-R"; /* enable DROPBEAR_DELAY_HOSTKEY */
|
||||
argv[argc++] = "-F"; /* don't redundant fork to background */
|
||||
|
Loading…
Reference in New Issue
Block a user