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

Method Bind

lib/base/unixsocket.cpp:23–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21}
22
23void UnixSocket::Bind(const String& path)
24{
25 unlink(path.CStr());
26
27 sockaddr_un s_un;
28 memset(&s_un, 0, sizeof(s_un));
29 s_un.sun_family = AF_UNIX;
30 strncpy(s_un.sun_path, path.CStr(), sizeof(s_un.sun_path));
31 s_un.sun_path[sizeof(s_un.sun_path) - 1] = '\0';
32
33 if (bind(GetFD(), (sockaddr *)&s_un, SUN_LEN(&s_un)) < 0) {
34 BOOST_THROW_EXCEPTION(posix_error()
35 << boost::errinfo_api_function("bind")
36 << boost::errinfo_errno(errno));
37 }
38}
39
40void UnixSocket::Connect(const String& path)
41{

Callers

nothing calls this directly

Calls 2

posix_errorClass · 0.85
CStrMethod · 0.80

Tested by

no test coverage detected