Forcibly detach earlier in blind effort to fix #114 (needs testing)

This commit is contained in:
Keith Winstein
2012-04-15 12:38:48 -04:00
parent 8f60f7ab05
commit cc8b1f293a
+8 -6
View File
@@ -307,6 +307,14 @@ int run_server( const char *desired_ip, const char *desired_port,
fprintf( stderr, "\nWarning: termios IUTF8 flag not defined.\nCharacter-erase of multibyte character sequence\nprobably does not work properly on this platform.\n" );
#endif /* HAVE_IUTF8 */
/* close file descriptors */
if ( !verbose ) {
/* Necessary to properly detach on old versions of sshd (e.g. RHEL/CentOS 5.0). */
close( STDIN_FILENO );
close( STDOUT_FILENO );
close( STDERR_FILENO );
}
/* Fork child process */
pid_t child = forkpty( &master, NULL, &child_termios, &window_size );
@@ -362,12 +370,6 @@ int run_server( const char *desired_ip, const char *desired_port,
}
} else {
/* parent */
if ( !verbose ) {
/* Necessary to properly detach on old versions of sshd (e.g. RHEL/CentOS 5.0). */
close( STDIN_FILENO );
close( STDOUT_FILENO );
close( STDERR_FILENO );
}
#ifdef HAVE_UTEMPTER
/* make utmp entry */