Skip to content
Snippets Groups Projects
Commit 58d93f69 authored by Daniel Salzman's avatar Daniel Salzman
Browse files

net: improve getsockopt usage (Coverity scan)

parent 1a724e0b
No related branches found
No related tags found
No related merge requests found
......@@ -259,10 +259,14 @@ bool net_is_connected(int sock)
int net_socktype(int sock)
{
int type = AF_UNSPEC;
int type;
socklen_t size = sizeof(type);
getsockopt(sock, SOL_SOCKET, SO_TYPE, &type, &size);
return type;
if (getsockopt(sock, SOL_SOCKET, SO_TYPE, &type, &size) == 0) {
return type;
} else {
return AF_UNSPEC;
}
}
bool net_is_stream(int sock)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment