Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
7d7995c6
Commit
7d7995c6
authored
Apr 07, 2012
by
Bruno Jesus
Committed by
Alexandre Julliard
Apr 09, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32/tests: Add hostent struct tests for gethostbyname.
parent
53181884
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
1 deletion
+41
-1
sock.c
dlls/ws2_32/tests/sock.c
+41
-1
No files found.
dlls/ws2_32/tests/sock.c
View file @
7d7995c6
...
...
@@ -2730,10 +2730,50 @@ static void test_getsockname(void)
static
void
test_dns
(
void
)
{
struct
hostent
*
h
;
struct
hostent
*
h
,
*
he
,
host
;
union
memaddress
{
char
*
chr
;
void
*
mem
;
}
addr
;
char
**
ptr
;
int
acount
;
void
*
ip_addr
,
*
alias_addr
;
h
=
gethostbyname
(
""
);
ok
(
h
!=
NULL
,
"gethostbyname(
\"\"
) failed with %d
\n
"
,
h_errno
);
if
(
h
)
host
=
*
h
;
/* Use an address with valid alias names if possible */
he
=
gethostbyname
(
"source.winehq.org"
);
if
(
he
)
h
=
he
;
else
if
(
h
)
h
=
&
host
;
else
{
skip
(
"Can't test the hostent structure because gethostbyname failed
\n
"
);
return
;
}
/* The returned struct must be allocated in a very strict way. First we need to
* count how many aliases there are because they must be located right after
* the struct hostent size. Knowing the amount of aliases we know the exact
* location of the first IP returned. Rule valid for >= XP, for older OS's
* it's somewhat the opposite. */
for
(
ptr
=
h
->
h_aliases
,
acount
=
1
;
*
ptr
;
ptr
++
)
acount
++
;
addr
.
mem
=
h
+
1
;
alias_addr
=
addr
.
mem
;
todo_wine
ok
(
h
->
h_aliases
==
alias_addr
||
broken
(
h
->
h_addr_list
==
alias_addr
/* <= W2K */
),
"hostent->h_aliases should be in %p, it is in %p
\n
"
,
alias_addr
,
h
->
h_aliases
);
addr
.
chr
+=
sizeof
(
h
->
h_aliases
)
*
acount
;
ip_addr
=
addr
.
mem
;
todo_wine
ok
(
h
->
h_addr_list
==
ip_addr
||
broken
(
h
->
h_addr_list
==
alias_addr
/* <= W2K */
),
"hostent->h_addr_list should be in %p, it is in %p
\n
"
,
ip_addr
,
h
->
h_addr_list
);
}
/* Our winsock headers don't define gethostname because it conflicts with the
...
...
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