1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

tt: prevent superfluous ttsession processes.

This commit is contained in:
Liang Chang 2022-03-24 14:49:03 +00:00
parent 3795cdbd5e
commit 1ac963d735
2 changed files with 6 additions and 13 deletions

View file

@ -358,6 +358,7 @@ int main(int argc, char **argv)
}
install_signal_handler();
signal(SIGCHLD, SIG_DFL);
// set up a pipe which will be used by the child ttsession to
// communicate it's session id to the parent ttsession which

View file

@ -150,7 +150,10 @@ init(_Tt_host_ptr &host, int program, int version,
memset(&_server_addr, 0, sizeof(_server_addr));
_server_addr.sin_family = AF_INET;
_server_addr.sin_port = htons((optval) ? 0 : 4000);
_server_addr.sin_addr.s_addr = inet_addr((char *)(_host->stringaddr()));
if (!inet_aton((char *)(_host->stringaddr()), &_server_addr.sin_addr))
return 0;
_client = clnttcp_create(&_server_addr, _program,
_version, &_socket, 4000, 4000);
if (_client == 0) {
@ -163,7 +166,7 @@ init(_Tt_host_ptr &host, int program, int version,
}
if (optval) {
#ifndef linux
#ifdef SO_USELOOPBACK
if (setsockopt(_socket, SOL_SOCKET, SO_USELOOPBACK,
(char *)&optval, sizeof(int)) == -1) {
_tt_syslog( 0, LOG_ERR, "_Tt_rpc_client::init(): "
@ -206,10 +209,6 @@ init(_Tt_host_ptr &host, int program, int version,
// Set close-on-exec bit so a libtt client which forks and execs won't
// be short some fd's in the child.
#if defined(__linux__)
// JET - for linux, we need to do this properly - I don't know
// how the original code below can be correct, so we'll do it
// differently.
{
long flags;
@ -225,13 +224,6 @@ init(_Tt_host_ptr &host, int program, int version,
"fcntl(F_SETFD): %m");
}
}
#else
if (-1==fcntl(_socket, F_SETFD, 1)) {
_tt_syslog( 0, LOG_ERR, "_Tt_rpc_client::init(): "
"fcntl(F_SETFD): %m");
}
#endif // linux
return(1);
}