Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
038399fc
Commit
038399fc
authored
Jan 19, 2015
by
Bruno Jesus
Committed by
Alexandre Julliard
Jan 20, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: getaddrinfo must SetLastError on success or failure.
parent
512a814e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletion
+27
-1
socket.c
dlls/ws2_32/socket.c
+6
-1
sock.c
dlls/ws2_32/tests/sock.c
+21
-0
No files found.
dlls/ws2_32/socket.c
View file @
038399fc
...
...
@@ -5628,7 +5628,11 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
const
char
*
node
;
*
res
=
NULL
;
if
(
!
nodename
&&
!
servname
)
return
WSAHOST_NOT_FOUND
;
if
(
!
nodename
&&
!
servname
)
{
SetLastError
(
WSAHOST_NOT_FOUND
);
return
WSAHOST_NOT_FOUND
;
}
if
(
!
nodename
)
node
=
NULL
;
...
...
@@ -5749,6 +5753,7 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
}
else
result
=
convert_eai_u2w
(
result
);
SetLastError
(
result
);
return
result
;
outofmem:
...
...
dlls/ws2_32/tests/sock.c
View file @
038399fc
...
...
@@ -5880,14 +5880,18 @@ static void test_GetAddrInfoW(void)
memset
(
&
hint
,
0
,
sizeof
(
ADDRINFOW
));
result
=
(
ADDRINFOW
*
)
0xdeadbeef
;
WSASetLastError
(
0xdeadbeef
);
ret
=
pGetAddrInfoW
(
NULL
,
NULL
,
NULL
,
&
result
);
ok
(
ret
==
WSAHOST_NOT_FOUND
,
"got %d expected WSAHOST_NOT_FOUND
\n
"
,
ret
);
ok
(
WSAGetLastError
()
==
WSAHOST_NOT_FOUND
,
"expected 11001, got %d
\n
"
,
WSAGetLastError
());
ok
(
result
==
NULL
,
"got %p
\n
"
,
result
);
result
=
NULL
;
WSASetLastError
(
0xdeadbeef
);
ret
=
pGetAddrInfoW
(
empty
,
NULL
,
NULL
,
&
result
);
ok
(
!
ret
,
"GetAddrInfoW failed with %d
\n
"
,
WSAGetLastError
());
ok
(
result
!=
NULL
,
"GetAddrInfoW failed
\n
"
);
ok
(
WSAGetLastError
()
==
0
,
"expected 0, got %d
\n
"
,
WSAGetLastError
());
pFreeAddrInfoW
(
result
);
result
=
NULL
;
...
...
@@ -5906,6 +5910,7 @@ static void test_GetAddrInfoW(void)
result
=
NULL
;
ret
=
pGetAddrInfoW
(
empty
,
zero
,
NULL
,
&
result
);
ok
(
!
ret
,
"GetAddrInfoW failed with %d
\n
"
,
WSAGetLastError
());
ok
(
WSAGetLastError
()
==
0
,
"expected 0, got %d
\n
"
,
WSAGetLastError
());
ok
(
result
!=
NULL
,
"GetAddrInfoW failed
\n
"
);
result2
=
NULL
;
...
...
@@ -5942,11 +5947,14 @@ static void test_GetAddrInfoW(void)
pFreeAddrInfoW
(
result
);
result
=
NULL
;
SetLastError
(
0xdeadbeef
);
ret
=
pGetAddrInfoW
(
localhost
,
port
,
&
hint
,
&
result
);
ok
(
!
ret
,
"GetAddrInfoW failed with %d
\n
"
,
WSAGetLastError
());
ok
(
WSAGetLastError
()
==
0
,
"expected 0, got %d
\n
"
,
WSAGetLastError
());
pFreeAddrInfoW
(
result
);
result
=
(
ADDRINFOW
*
)
0xdeadbeef
;
WSASetLastError
(
0xdeadbeef
);
ret
=
pGetAddrInfoW
(
NULL
,
NULL
,
NULL
,
&
result
);
if
(
ret
==
0
)
{
...
...
@@ -5954,9 +5962,11 @@ static void test_GetAddrInfoW(void)
return
;
}
ok
(
ret
==
WSAHOST_NOT_FOUND
,
"got %d expected WSAHOST_NOT_FOUND
\n
"
,
ret
);
ok
(
WSAGetLastError
()
==
WSAHOST_NOT_FOUND
,
"expected 11001, got %d
\n
"
,
WSAGetLastError
());
ok
(
result
==
NULL
,
"got %p
\n
"
,
result
);
result
=
(
ADDRINFOW
*
)
0xdeadbeef
;
WSASetLastError
(
0xdeadbeef
);
ret
=
pGetAddrInfoW
(
nxdomain
,
NULL
,
NULL
,
&
result
);
if
(
ret
==
0
)
{
...
...
@@ -5964,6 +5974,7 @@ static void test_GetAddrInfoW(void)
return
;
}
ok
(
ret
==
WSAHOST_NOT_FOUND
,
"got %d expected WSAHOST_NOT_FOUND
\n
"
,
ret
);
ok
(
WSAGetLastError
()
==
WSAHOST_NOT_FOUND
,
"expected 11001, got %d
\n
"
,
WSAGetLastError
());
ok
(
result
==
NULL
,
"got %p
\n
"
,
result
);
for
(
i
=
0
;
i
<
(
sizeof
(
hinttests
)
/
sizeof
(
hinttests
[
0
]));
i
++
)
...
...
@@ -6031,14 +6042,18 @@ static void test_getaddrinfo(void)
memset
(
&
hint
,
0
,
sizeof
(
ADDRINFOA
));
result
=
(
ADDRINFOA
*
)
0xdeadbeef
;
WSASetLastError
(
0xdeadbeef
);
ret
=
pgetaddrinfo
(
NULL
,
NULL
,
NULL
,
&
result
);
ok
(
ret
==
WSAHOST_NOT_FOUND
,
"got %d expected WSAHOST_NOT_FOUND
\n
"
,
ret
);
ok
(
WSAGetLastError
()
==
WSAHOST_NOT_FOUND
,
"expected 11001, got %d
\n
"
,
WSAGetLastError
());
ok
(
result
==
NULL
,
"got %p
\n
"
,
result
);
result
=
NULL
;
WSASetLastError
(
0xdeadbeef
);
ret
=
pgetaddrinfo
(
""
,
NULL
,
NULL
,
&
result
);
ok
(
!
ret
,
"getaddrinfo failed with %d
\n
"
,
WSAGetLastError
());
ok
(
result
!=
NULL
,
"getaddrinfo failed
\n
"
);
ok
(
WSAGetLastError
()
==
0
,
"expected 0, got %d
\n
"
,
WSAGetLastError
());
pfreeaddrinfo
(
result
);
result
=
NULL
;
...
...
@@ -6055,8 +6070,10 @@ static void test_getaddrinfo(void)
pfreeaddrinfo
(
result2
);
result
=
NULL
;
WSASetLastError
(
0xdeadbeef
);
ret
=
pgetaddrinfo
(
""
,
"0"
,
NULL
,
&
result
);
ok
(
!
ret
,
"getaddrinfo failed with %d
\n
"
,
WSAGetLastError
());
ok
(
WSAGetLastError
()
==
0
,
"expected 0, got %d
\n
"
,
WSAGetLastError
());
ok
(
result
!=
NULL
,
"getaddrinfo failed
\n
"
);
result2
=
NULL
;
...
...
@@ -6093,11 +6110,14 @@ static void test_getaddrinfo(void)
pfreeaddrinfo
(
result
);
result
=
NULL
;
WSASetLastError
(
0xdeadbeef
);
ret
=
pgetaddrinfo
(
"localhost"
,
"80"
,
&
hint
,
&
result
);
ok
(
!
ret
,
"getaddrinfo failed with %d
\n
"
,
WSAGetLastError
());
ok
(
WSAGetLastError
()
==
0
,
"expected 0, got %d
\n
"
,
WSAGetLastError
());
pfreeaddrinfo
(
result
);
result
=
(
ADDRINFOA
*
)
0xdeadbeef
;
WSASetLastError
(
0xdeadbeef
);
ret
=
pgetaddrinfo
(
"nxdomain.codeweavers.com"
,
NULL
,
NULL
,
&
result
);
if
(
ret
==
0
)
{
...
...
@@ -6105,6 +6125,7 @@ static void test_getaddrinfo(void)
return
;
}
ok
(
ret
==
WSAHOST_NOT_FOUND
,
"got %d expected WSAHOST_NOT_FOUND
\n
"
,
ret
);
ok
(
WSAGetLastError
()
==
WSAHOST_NOT_FOUND
,
"expected 11001, got %d
\n
"
,
WSAGetLastError
());
ok
(
result
==
NULL
,
"got %p
\n
"
,
result
);
for
(
i
=
0
;
i
<
(
sizeof
(
hinttests
)
/
sizeof
(
hinttests
[
0
]));
i
++
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment