Changeset View
Changeset View
Standalone View
Standalone View
games/eboard/files/patch-network.cc
--- network.cc.orig 2008-02-22 16:51:22.000000000 +0100 | --- network.cc.orig 2018-07-31 18:02:19 UTC | ||||
+++ network.cc 2008-12-29 11:24:10.000000000 +0100 | +++ network.cc | ||||
@@ -566,6 +566,7 @@ | @@ -501,7 +501,7 @@ int IncomingConnection::createSocket() { | ||||
sin.sin_addr.s_addr = INADDR_ANY; | |||||
sin.sin_port = htons(Port); | |||||
- if (bind(netsocket,(struct sockaddr *) &sin,sizeof(sin))==-1) { | |||||
+ if (::bind(netsocket,(struct sockaddr *) &sin,sizeof(sin))==-1) { | |||||
snprintf(errorMessage,128,_("Unable to bind on port %d."),Port); | |||||
return(-1); | |||||
} | |||||
@@ -604,6 +604,7 @@ PipeConnection::PipeConnection(int _pin,int _pout) { | |||||
strcpy(HostName,"local pipe"); | strcpy(HostName,"local pipe"); | ||||
snprintf(HostAddress,96,"pipe[%d,%d]",pin,pout); | snprintf(HostAddress,96,"pipe[%d,%d]",pin,pout); | ||||
Quiet=0; | Quiet=0; | ||||
+ use_execve=0; | + use_execve=0; | ||||
MaxWaitTime = 60000.0; // 1 minute | MaxWaitTime = 60000.0; // 1 minute | ||||
} | } | ||||
@@ -577,6 +578,7 @@ | @@ -615,6 +616,7 @@ void PipeConnection::init() { | ||||
strcpy(HostAddress,"unknown"); | strcpy(HostAddress,"unknown"); | ||||
memset(HelperBin,0,512); | memset(HelperBin,0,512); | ||||
Quiet=0; | Quiet=0; | ||||
+ use_execve=0; | + use_execve=0; | ||||
handshake.erase(); | handshake.erase(); | ||||
MaxWaitTime = 60000.0; // 1 minute | MaxWaitTime = 60000.0; // 1 minute | ||||
} | } | ||||
@@ -612,6 +614,25 @@ | @@ -652,6 +654,25 @@ PipeConnection::PipeConnection(const char *host,int po | ||||
Port=port; | Port=port; | ||||
g_strlcpy(HostName,host,128); | g_strlcpy(HostName,host,128); | ||||
+ // Special handling for timeseal on FreeBSD: | + // Special handling for timeseal on FreeBSD: | ||||
+ // | + // | ||||
+ // On FreeBSD, the games/timeseal port provides an a.out timeseal | + // On FreeBSD, the games/timeseal port provides an a.out timeseal | ||||
+ // binary. However, a.out support is disabled by default on FreeBSD | + // binary. However, a.out support is disabled by default on FreeBSD | ||||
+ // >= 5.x. If the a.out kernel module is not loaded, or if a.out | + // >= 5.x. If the a.out kernel module is not loaded, or if a.out | ||||
Show All 9 Lines | |||||
+ // but this is not a problem since eboard uses the absolute path to | + // but this is not a problem since eboard uses the absolute path to | ||||
+ // timeseal. | + // timeseal. | ||||
+ if (! strcmp(helperbin, "timeseal")) | + if (! strcmp(helperbin, "timeseal")) | ||||
+ use_execve = 1; | + use_execve = 1; | ||||
+ | + | ||||
// build helper path | // build helper path | ||||
if (helpersuffix) | if (helpersuffix) | ||||
snprintf(z,256,"%s.%s",helperbin,helpersuffix); | snprintf(z,256,"%s.%s",helperbin,helpersuffix); | ||||
@@ -728,7 +749,10 @@ | @@ -768,7 +789,10 @@ int PipeConnection::open() { | ||||
dup2(1,2); | dup2(1,2); | ||||
setpgid(getpid(),0); // to broadcast SIGKILL later | setpgid(getpid(),0); // to broadcast SIGKILL later | ||||
- execvp(HelperBin,arguments); | - execvp(HelperBin,arguments); | ||||
+ if (use_execve) | + if (use_execve) | ||||
+ execve(HelperBin,arguments,NULL); | + execve(HelperBin,arguments,NULL); | ||||
+ else | + else | ||||
+ execvp(HelperBin,arguments); | + execvp(HelperBin,arguments); | ||||
write(1,"exec failed\n",12); | write(1,"exec failed\n",12); | ||||
global.debug("exec failed",HelperBin); | global.debug("exec failed",HelperBin); | ||||
_exit(2); // eek | _exit(2); // eek |