Skip to content

Commit

Permalink
Workaround gcc segfault (Fixes #97)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanGriffiths committed Dec 11, 2017
1 parent 60fbba7 commit f0557e7
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/server/frontend/wayland/wayland_connector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2313,22 +2313,20 @@ int mf::WaylandConnector::client_socket_fd() const
enum { server, client, size };
int socket_fd[size];

char const* error = nullptr;

if (socketpair(AF_LOCAL, SOCK_STREAM, 0, socket_fd))
{
BOOST_THROW_EXCEPTION((std::system_error{
errno,
std::system_category(),
"Could not create socket pair"}));
error = "Could not create socket pair";
}

if (!wl_client_create(display.get(), socket_fd[server]))
else if (!wl_client_create(display.get(), socket_fd[server]))
{
BOOST_THROW_EXCEPTION((std::system_error{
errno,
std::system_category(),
"Failed to add server end of socketpair to Wayland display"}));
error = "Failed to add server end of socketpair to Wayland display";
}

if (error)
BOOST_THROW_EXCEPTION((std::system_error{errno, std::system_category(), error}));

return socket_fd[client];
}

Expand Down

0 comments on commit f0557e7

Please sign in to comment.