mirror of https://github.com/wolfSSL/wolfssh.git
Merge pull request #721 from lealem47/zd18257
Don't exit wolfSSHd daemon on recoverable fcntl failurepull/723/head
commit
94ebc62b18
|
@ -2413,19 +2413,34 @@ static int StartSSHD(int argc, char** argv)
|
||||||
#ifdef USE_WINDOWS_API
|
#ifdef USE_WINDOWS_API
|
||||||
unsigned long blocking = 1;
|
unsigned long blocking = 1;
|
||||||
if (ioctlsocket(conn->fd, FIONBIO, &blocking)
|
if (ioctlsocket(conn->fd, FIONBIO, &blocking)
|
||||||
== SOCKET_ERROR)
|
== SOCKET_ERROR) {
|
||||||
err_sys("ioctlsocket failed");
|
WLOG(WS_LOG_DEBUG, "wolfSSH non-fatal error: "
|
||||||
|
"ioctlsocket failed");
|
||||||
|
WCLOSESOCKET(conn->fd);
|
||||||
|
WFREE(conn, NULL, DYNTYPE_SSHD);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
#elif defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) \
|
#elif defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) \
|
||||||
|| defined (WOLFSSL_TIRTOS)|| defined(WOLFSSL_VXWORKS) || \
|
|| defined (WOLFSSL_TIRTOS)|| defined(WOLFSSL_VXWORKS) || \
|
||||||
defined(WOLFSSL_NUCLEUS)
|
defined(WOLFSSL_NUCLEUS)
|
||||||
/* non blocking not supported, for now */
|
/* non blocking not supported, for now */
|
||||||
#else
|
#else
|
||||||
int flags = fcntl(conn->fd, F_GETFL, 0);
|
int flags = fcntl(conn->fd, F_GETFL, 0);
|
||||||
if (flags < 0)
|
if (flags < 0) {
|
||||||
err_sys("fcntl get failed");
|
WLOG(WS_LOG_DEBUG, "wolfSSH non-fatal error: "
|
||||||
|
"fcntl get failed");
|
||||||
|
WCLOSESOCKET(conn->fd);
|
||||||
|
WFREE(conn, NULL, DYNTYPE_SSHD);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
flags = fcntl(conn->fd, F_SETFL, flags | O_NONBLOCK);
|
flags = fcntl(conn->fd, F_SETFL, flags | O_NONBLOCK);
|
||||||
if (flags < 0)
|
if (flags < 0) {
|
||||||
err_sys("fcntl set failed");
|
WLOG(WS_LOG_DEBUG, "wolfSSH non-fatal error: "
|
||||||
|
"fcntl set failed");
|
||||||
|
WCLOSESOCKET(conn->fd);
|
||||||
|
WFREE(conn, NULL, DYNTYPE_SSHD);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
ret = NewConnection(conn);
|
ret = NewConnection(conn);
|
||||||
|
|
Loading…
Reference in New Issue