Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tammo Jan Dijkema
dt_ctrl
Commits
cdce9652
Commit
cdce9652
authored
Jul 30, 2015
by
Jeroen Vreeken
Browse files
Prevent yielding forever when accept socket could not be opened.
parent
6b59f087
Changes
1
Hide whitespace changes
Inline
Side-by-side
common/log/log.c
View file @
cdce9652
...
...
@@ -226,13 +226,13 @@ static void *log_server(void *arg)
(
struct
sockaddr
*
)
&
sockaddr
,
sizeof
(
sockaddr
))
<
0
)
{
perror
(
"bind() failed"
);
close
(
fd_accept
);
return
NULL
;
fd_accept
=
-
1
;
}
if
(
listen
(
fd_accept
,
4
)
<
0
)
{
if
(
fd_accept
>=
0
&&
listen
(
fd_accept
,
4
)
<
0
)
{
perror
(
"listen() failed"
);
close
(
fd_accept
);
return
NULL
;
fd_accept
=
-
1
;
}
while
(
1
)
{
...
...
@@ -247,7 +247,7 @@ static void *log_server(void *arg)
sem_wait
(
&
queue_wait
);
}
do
{
if
(
fd_accept
>=
0
)
do
{
FD_ZERO
(
&
fdset_r
);
FD_SET
(
fd_accept
,
&
fdset_r
);
tv
.
tv_sec
=
0
;
...
...
@@ -358,9 +358,10 @@ int log_server_start(int port, enum log_type console_level,
printf
(
"Starting log server on port %d
\n
"
,
port
);
pthread_attr_init
(
&
attr
);
#ifndef __FreeBSD__
pthread_attr_setstacksize
(
&
attr
,
PTHREAD_STACK_MIN
*
2
);
#endif
/* PTHREAD_STACK_MIN * 2 seems to be the minimum on some old FreeBSD
releases
*/
pthread_attr_setstacksize
(
&
attr
,
PTHREAD_STACK_MIN
*
2
+
65536
);
pthread_create
(
&
thread_id
,
&
attr
,
log_server
,
NULL
);
...
...
Write
Preview
Supports
Markdown
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