mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
- Check that we got a valid socket before trying to bind
svn path=/trunk/; revision=42958
This commit is contained in:
parent
895075e99c
commit
0ea9c96b9c
1 changed files with 12 additions and 7 deletions
|
@ -299,13 +299,18 @@ BOOLEAN AdapterDiscover() {
|
|||
Adapter->DhclientInfo.rfdesc =
|
||||
Adapter->DhclientInfo.wfdesc =
|
||||
socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP );
|
||||
Adapter->ListenAddr.sin_family = AF_INET;
|
||||
Adapter->ListenAddr.sin_port = htons(LOCAL_PORT);
|
||||
Adapter->BindStatus =
|
||||
(bind( Adapter->DhclientInfo.rfdesc,
|
||||
(struct sockaddr *)&Adapter->ListenAddr,
|
||||
sizeof(Adapter->ListenAddr) ) == 0) ?
|
||||
0 : WSAGetLastError();
|
||||
|
||||
if (DhcpSocket != INVALID_SOCKET) {
|
||||
Adapter->ListenAddr.sin_family = AF_INET;
|
||||
Adapter->ListenAddr.sin_port = htons(LOCAL_PORT);
|
||||
Adapter->BindStatus =
|
||||
(bind( Adapter->DhclientInfo.rfdesc,
|
||||
(struct sockaddr *)&Adapter->ListenAddr,
|
||||
sizeof(Adapter->ListenAddr) ) == 0) ?
|
||||
0 : WSAGetLastError();
|
||||
} else {
|
||||
error("socket() failed: %d\n", WSAGetLastError());
|
||||
}
|
||||
} else {
|
||||
Adapter->DhclientInfo.rfdesc =
|
||||
Adapter->DhclientInfo.wfdesc = DhcpSocket;
|
||||
|
|
Loading…
Reference in a new issue