nxlink: only connect to host if a valid remote address has been set.

This commit is contained in:
Pablo Curiel 2021-07-21 07:57:41 -04:00
parent d90afaacde
commit de9b357ff7
2 changed files with 5 additions and 2 deletions

View File

@ -7,8 +7,7 @@
extern int __system_argc; extern int __system_argc;
extern char** __system_argv; extern char** __system_argv;
struct in_addr __nxlink_host; struct in_addr __nxlink_host = { .s_addr = INADDR_NONE };
void nxlinkSetup(void) void nxlinkSetup(void)
{ {

View File

@ -11,6 +11,10 @@ static int sock = -1;
int nxlinkConnectToHost(bool redirStdout, bool redirStderr) int nxlinkConnectToHost(bool redirStdout, bool redirStderr)
{ {
if ((!redirStdout && !redirStderr) || __nxlink_host.s_addr == INADDR_NONE) {
return -1;
}
int ret = -1; int ret = -1;
struct sockaddr_in srv_addr; struct sockaddr_in srv_addr;