diff --git a/nx/include/switch/runtime/devices/socket.h b/nx/include/switch/runtime/devices/socket.h index 3a552eff..58ed9d68 100644 --- a/nx/include/switch/runtime/devices/socket.h +++ b/nx/include/switch/runtime/devices/socket.h @@ -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); diff --git a/nx/source/runtime/devices/socket.c b/nx/source/runtime/devices/socket.c index 0a3b4be4..02eddf3f 100644 --- a/nx/source/runtime/devices/socket.c +++ b/nx/source/runtime/devices/socket.c @@ -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;