socket-ssl: Updated docs. Check for output sockfd=-1 from the cmd with socketSslConnectionSetSocketDescriptor.

This commit is contained in:
yellows8 2020-04-24 16:19:33 -04:00
parent 41e90ef8b5
commit 3b2b3ebad4
2 changed files with 7 additions and 2 deletions

View File

@ -40,9 +40,9 @@ NX_INLINE Result socketInitializeDefault(void) {
return socketInitialize(NULL);
}
/// Wrapper for \ref sslConnectionSetSocketDescriptor. Returns the output sockfd on success.
/// Wrapper for \ref sslConnectionSetSocketDescriptor. Returns the output sockfd on success and -1 on error. errno==ENOENT indicates that no sockfd was returned, this error must be ignored.
int socketSslConnectionSetSocketDescriptor(SslConnection *c, int sockfd);
/// Wrapper for \ref sslConnectionGetSocketDescriptor. Returns the output sockfd on success.
/// Wrapper for \ref sslConnectionGetSocketDescriptor. Returns the output sockfd on success and -1 on error.
int socketSslConnectionGetSocketDescriptor(SslConnection *c);

View File

@ -156,6 +156,11 @@ int socketSslConnectionSetSocketDescriptor(SslConnection *c, int sockfd) {
return -1;
}
if (tmpfd==-1) { // The cmd didn't return a sockfd. This error must be ignored.
errno = ENOENT;
return -1;
}
dev = FindDevice("soc:");
if(dev == -1)
return -1;