MCPcopy Create free account
hub / github.com/Icinga/icinga2 / GetError

Method GetError

lib/base/socket.cpp:85–96  ·  view source on GitHub ↗

* Retrieves the last error that occurred for the socket. * * @returns An error code. */

Source from the content-addressed store, hash-verified

83 * @returns An error code.
84 */
85int Socket::GetError() const
86{
87 int opt;
88 socklen_t optlen = sizeof(opt);
89
90 int rc = getsockopt(GetFD(), SOL_SOCKET, SO_ERROR, (char *)&opt, &optlen);
91
92 if (rc >= 0)
93 return opt;
94
95 return 0;
96}
97
98/**
99 * Formats a sockaddr in a human-readable way.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected