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
f9f9566c
Commit
f9f9566c
authored
Dec 05, 2009
by
Erich Hoover
Committed by
Alexandre Julliard
Dec 10, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: Separate out hostent creation from duplication.
parent
49d40d80
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
15 deletions
+43
-15
socket.c
dlls/ws2_32/socket.c
+43
-15
No files found.
dlls/ws2_32/socket.c
View file @
f9f9566c
...
@@ -282,6 +282,7 @@ static INT num_startup; /* reference counter */
...
@@ -282,6 +282,7 @@ static INT num_startup; /* reference counter */
static
FARPROC
blocking_hook
=
(
FARPROC
)
WSA_DefaultBlockingHook
;
static
FARPROC
blocking_hook
=
(
FARPROC
)
WSA_DefaultBlockingHook
;
/* function prototypes */
/* function prototypes */
static
struct
WS_hostent
*
WS_create_he
(
char
*
name
,
int
aliases
,
int
addresses
);
static
struct
WS_hostent
*
WS_dup_he
(
const
struct
hostent
*
p_he
);
static
struct
WS_hostent
*
WS_dup_he
(
const
struct
hostent
*
p_he
);
static
struct
WS_protoent
*
WS_dup_pe
(
const
struct
protoent
*
p_pe
);
static
struct
WS_protoent
*
WS_dup_pe
(
const
struct
protoent
*
p_pe
);
static
struct
WS_servent
*
WS_dup_se
(
const
struct
servent
*
p_se
);
static
struct
WS_servent
*
WS_dup_se
(
const
struct
servent
*
p_se
);
...
@@ -4459,33 +4460,60 @@ static int list_dup(char** l_src, char** l_to, int item_size)
...
@@ -4459,33 +4460,60 @@ static int list_dup(char** l_src, char** l_to, int item_size)
/* ----- hostent */
/* ----- hostent */
/* duplicate hostent entry
/* create a hostent entry
* and handle all Win16/Win32 dependent things (struct size, ...) *correctly*.
*
* Ditto for protoent and servent.
* Creates the entry with enough memory for the name, aliases
* addresses, and the address pointers. Also copies the name
* and sets up all the pointers.
*/
*/
static
struct
WS_hostent
*
WS_
dup_he
(
const
struct
hostent
*
p_he
)
static
struct
WS_hostent
*
WS_
create_he
(
char
*
name
,
int
aliases
,
int
addresses
)
{
{
char
*
p
;
struct
WS_hostent
*
p_to
;
struct
WS_hostent
*
p_to
;
char
*
p
;
int
size
=
(
sizeof
(
*
p_he
)
+
int
size
=
(
sizeof
(
struct
WS_hostent
)
+
strlen
(
p_he
->
h_
name
)
+
1
+
strlen
(
name
)
+
1
+
list_size
(
p_he
->
h_aliases
,
0
)
+
sizeof
(
char
*
)
*
aliases
+
list_size
(
p_he
->
h_addr_list
,
p_he
->
h_length
)
);
sizeof
(
char
*
)
*
addresses
);
if
(
!
(
p_to
=
check_buffer_he
(
size
)))
return
NULL
;
if
(
!
(
p_to
=
check_buffer_he
(
size
)))
return
NULL
;
p_to
->
h_addrtype
=
p_he
->
h_addrtype
;
memset
(
p_to
,
0
,
size
);
p_to
->
h_length
=
p_he
->
h_length
;
p
=
(
char
*
)(
p_to
+
1
);
p
=
(
char
*
)(
p_to
+
1
);
p_to
->
h_name
=
p
;
p_to
->
h_name
=
p
;
strcpy
(
p
,
p_he
->
h_
name
);
strcpy
(
p
,
name
);
p
+=
strlen
(
p
)
+
1
;
p
+=
strlen
(
p
)
+
1
;
p_to
->
h_aliases
=
(
char
**
)
p
;
if
(
aliases
!=
0
)
p
+=
list_dup
(
p_he
->
h_aliases
,
p_to
->
h_aliases
,
0
);
{
p_to
->
h_aliases
=
(
char
**
)
p
;
p
+=
sizeof
(
char
*
)
*
aliases
;
}
if
(
addresses
!=
0
)
{
p_to
->
h_addr_list
=
(
char
**
)
p
;
p
+=
sizeof
(
char
*
)
*
addresses
;
}
return
p_to
;
}
/* duplicate hostent entry
* and handle all Win16/Win32 dependent things (struct size, ...) *correctly*.
* Ditto for protoent and servent.
*/
static
struct
WS_hostent
*
WS_dup_he
(
const
struct
hostent
*
p_he
)
{
int
addresses
=
list_size
(
p_he
->
h_addr_list
,
p_he
->
h_length
);
int
aliases
=
list_size
(
p_he
->
h_aliases
,
0
);
struct
WS_hostent
*
p_to
;
p_to
=
WS_create_he
(
p_he
->
h_name
,
aliases
,
addresses
);
if
(
!
p_to
)
return
NULL
;
p_to
->
h_addrtype
=
p_he
->
h_addrtype
;
p_to
->
h_length
=
p_he
->
h_length
;
p_to
->
h_addr_list
=
(
char
**
)
p
;
list_dup
(
p_he
->
h_aliases
,
p_to
->
h_aliases
,
0
)
;
list_dup
(
p_he
->
h_addr_list
,
p_to
->
h_addr_list
,
p_he
->
h_length
);
list_dup
(
p_he
->
h_addr_list
,
p_to
->
h_addr_list
,
p_he
->
h_length
);
return
p_to
;
return
p_to
;
}
}
...
...
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