mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibCore: Log a more helpful message when Socket::connect() fails
Fixes #1272.
This commit is contained in:
parent
82fd09e8fe
commit
28f1486627
Notes:
sideshowbarker
2024-07-19 09:09:55 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/28f1486627f
1 changed files with 5 additions and 1 deletions
|
@ -113,6 +113,8 @@ bool Socket::connect(const SocketAddress& address)
|
|||
saddr.sun_family = AF_LOCAL;
|
||||
strcpy(saddr.sun_path, address.to_string().characters());
|
||||
|
||||
m_destination_address = address;
|
||||
|
||||
return common_connect((const sockaddr*)&saddr, sizeof(saddr));
|
||||
}
|
||||
|
||||
|
@ -137,7 +139,9 @@ bool Socket::common_connect(const struct sockaddr* addr, socklen_t addrlen)
|
|||
};
|
||||
return true;
|
||||
}
|
||||
perror("Socket::common_connect: connect");
|
||||
int saved_errno = errno;
|
||||
fprintf(stderr, "Core::Socket: Failed to connect() to %s: %s\n", destination_address().to_string().characters(), strerror(saved_errno));
|
||||
errno = saved_errno;
|
||||
return false;
|
||||
}
|
||||
#ifdef CSOCKET_DEBUG
|
||||
|
|
Loading…
Reference in a new issue