Skip to content

Commit

Permalink
Fix connect() error detection (GH-163)
Browse files Browse the repository at this point in the history
  • Loading branch information
amonakov committed Mar 28, 2015
1 parent 9bf62c4 commit d1afbf6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions libglfork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,12 @@ struct EarlyInitializer {
{
#ifdef BUMBLEBEE_SOCKET
// Signal the Bumblebee daemon to bring up secondary X
errno = 0;
int sock = socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
struct sockaddr_un addr;
addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, getconf(BUMBLEBEE_SOCKET), sizeof(addr.sun_path));
connect(sock, (struct sockaddr *)&addr, sizeof(addr));
die_if(errno, "failed to connect to Bumblebee daemon: %s\n", strerror(errno));
die_if(connect(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0,
"failed to connect to Bumblebee daemon: %s\n", strerror(errno));
static char c[256];
if (!getenv("PRIMUS_DISPLAY"))
{
Expand Down

0 comments on commit d1afbf6

Please sign in to comment.