Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Иван Мажукин
mpd
Commits
019bca24
Commit
019bca24
authored
Jan 03, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
listen: use gethostbyname() on WIN32
WIN32 has no getaddrinfo(). Fall back to gethostbyname().
parent
fa9b5fd1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
listen.c
src/listen.c
+18
-0
No files found.
src/listen.c
View file @
019bca24
...
...
@@ -174,6 +174,7 @@ parseListenConfigParam(G_GNUC_UNUSED unsigned int port, ConfigParam * param)
#endif
/* HAVE_UN */
}
else
{
#ifdef HAVE_TCP
#ifndef WIN32
struct
addrinfo
hints
,
*
ai
,
*
i
;
char
service
[
20
];
int
ret
;
...
...
@@ -202,6 +203,23 @@ parseListenConfigParam(G_GNUC_UNUSED unsigned int port, ConfigParam * param)
BINDERROR
();
freeaddrinfo
(
ai
);
#else
/* WIN32 */
const
struct
hostent
*
he
;
g_debug
(
"binding to address for %s"
,
param
->
value
);
he
=
gethostbyname
(
param
->
value
);
if
(
he
==
NULL
)
g_error
(
"can't lookup host
\"
%s
\"
at line %i"
,
param
->
value
,
param
->
line
);
if
(
he
->
h_addrtype
!=
AF_INET
)
g_error
(
"IPv4 address expected for host
\"
%s
\"
at line %i"
,
param
->
value
,
param
->
line
);
if
(
establishListen
(
AF_INET
,
he
->
h_addr
,
he
->
h_length
)
<
0
)
BINDERROR
();
#endif
/* !WIN32 */
#else
/* HAVE_TCP */
g_error
(
"TCP support is disabled"
);
#endif
/* HAVE_TCP */
...
...
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