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
9193766c
Commit
9193766c
authored
Mar 19, 2005
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix some signal handling
git-svn-id:
https://svn.musicpd.org/mpd/trunk@3101
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
d392b7e4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
15 deletions
+13
-15
decode.c
src/decode.c
+1
-9
interface.c
src/interface.c
+11
-0
sig_handlers.c
src/sig_handlers.c
+1
-6
No files found.
src/decode.c
View file @
9193766c
...
@@ -44,9 +44,7 @@ void decodeSigHandler(int sig, siginfo_t * si, void * v) {
...
@@ -44,9 +44,7 @@ void decodeSigHandler(int sig, siginfo_t * si, void * v) {
int
status
;
int
status
;
if
(
decode_pid
==
wait3
(
&
status
,
WNOHANG
,
NULL
))
{
if
(
decode_pid
==
wait3
(
&
status
,
WNOHANG
,
NULL
))
{
if
(
WIFSIGNALED
(
status
))
{
if
(
WIFSIGNALED
(
status
))
{
if
(
WTERMSIG
(
status
)
!=
SIGTERM
&&
if
(
WTERMSIG
(
status
)
!=
SIGTERM
)
{
WTERMSIG
(
status
)
!=
SIGINT
)
{
ERROR
(
"decode process died from "
ERROR
(
"decode process died from "
"signal: %i
\n
"
,
"signal: %i
\n
"
,
WTERMSIG
(
status
));
WTERMSIG
(
status
));
...
@@ -65,12 +63,6 @@ void decodeSigHandler(int sig, siginfo_t * si, void * v) {
...
@@ -65,12 +63,6 @@ void decodeSigHandler(int sig, siginfo_t * si, void * v) {
else
DEBUG
(
"decoder (or child) got SIGTERM
\n
"
);
else
DEBUG
(
"decoder (or child) got SIGTERM
\n
"
);
exit
(
EXIT_SUCCESS
);
exit
(
EXIT_SUCCESS
);
}
}
else
if
(
sig
==
SIGINT
)
{
if
(
decode_pid
>
0
)
{
DEBUG
(
"player (or child) got SIGINT
\n
"
);
}
else
DEBUG
(
"decoder (or child) got SIGINT
\n
"
);
}
}
}
void
stopDecode
(
DecoderControl
*
dc
)
{
void
stopDecode
(
DecoderControl
*
dc
)
{
...
...
src/interface.c
View file @
9193766c
...
@@ -629,11 +629,15 @@ void printInterfaceOutBuffer(Interface * interface) {
...
@@ -629,11 +629,15 @@ void printInterfaceOutBuffer(Interface * interface) {
char
*
buffer
;
char
*
buffer
;
int
ret
;
int
ret
;
DEBUG
(
"enter print interface out buffer
\n
"
);
if
(
!
interface
->
open
||
interface
->
expired
||
!
interface
->
outBuflen
)
{
if
(
!
interface
->
open
||
interface
->
expired
||
!
interface
->
outBuflen
)
{
DEBUG
(
"nothing todo, leaving
\n
"
);
return
;
return
;
}
}
if
(
interface
->
bufferList
)
{
if
(
interface
->
bufferList
)
{
DEBUG
(
"we have a bufferList
\n
"
);
interface
->
outputBufferSize
+=
sizeof
(
ListNode
);
interface
->
outputBufferSize
+=
sizeof
(
ListNode
);
interface
->
outputBufferSize
+=
interface
->
outBuflen
+
1
;
interface
->
outputBufferSize
+=
interface
->
outBuflen
+
1
;
if
(
interface
->
outputBufferSize
>
if
(
interface
->
outputBufferSize
>
...
@@ -658,9 +662,12 @@ void printInterfaceOutBuffer(Interface * interface) {
...
@@ -658,9 +662,12 @@ void printInterfaceOutBuffer(Interface * interface) {
}
}
}
}
else
{
else
{
DEBUG
(
"no bufferList, just generic buffer
\n
"
);
DEBUG
(
"attempting to write
\n
"
);
if
((
ret
=
write
(
interface
->
fd
,
interface
->
outBuffer
,
if
((
ret
=
write
(
interface
->
fd
,
interface
->
outBuffer
,
interface
->
outBuflen
))
<
0
)
interface
->
outBuflen
))
<
0
)
{
{
DEBUG
(
"write unsuccessful
\n
"
);
if
(
errno
==
EAGAIN
||
errno
==
EINTR
)
{
if
(
errno
==
EAGAIN
||
errno
==
EINTR
)
{
buffer
=
malloc
(
interface
->
outBuflen
+
1
);
buffer
=
malloc
(
interface
->
outBuflen
+
1
);
memcpy
(
buffer
,
interface
->
outBuffer
,
memcpy
(
buffer
,
interface
->
outBuffer
,
...
@@ -678,6 +685,7 @@ void printInterfaceOutBuffer(Interface * interface) {
...
@@ -678,6 +685,7 @@ void printInterfaceOutBuffer(Interface * interface) {
}
}
}
}
else
if
(
ret
<
interface
->
outBuflen
)
{
else
if
(
ret
<
interface
->
outBuflen
)
{
DEBUG
(
"returned less than outBufLen
\n
"
);
buffer
=
malloc
(
interface
->
outBuflen
-
ret
+
1
);
buffer
=
malloc
(
interface
->
outBuflen
-
ret
+
1
);
memcpy
(
buffer
,
interface
->
outBuffer
+
ret
,
memcpy
(
buffer
,
interface
->
outBuffer
+
ret
,
interface
->
outBuflen
-
ret
);
interface
->
outBuflen
-
ret
);
...
@@ -694,7 +702,10 @@ void printInterfaceOutBuffer(Interface * interface) {
...
@@ -694,7 +702,10 @@ void printInterfaceOutBuffer(Interface * interface) {
(
char
*
)
interface
->
bufferList
->
(
char
*
)
interface
->
bufferList
->
firstNode
->
data
)
+
1
;
firstNode
->
data
)
+
1
;
}
}
DEBUG
(
"done writing
\n
"
);
}
}
interface
->
outBuflen
=
0
;
interface
->
outBuflen
=
0
;
DEBUG
(
"leaving print interface out buffer
\n
"
);
}
}
src/sig_handlers.c
View file @
9193766c
...
@@ -72,9 +72,7 @@ void initSigHandlers() {
...
@@ -72,9 +72,7 @@ void initSigHandlers() {
struct
sigaction
sa
;
struct
sigaction
sa
;
sa
.
sa_flags
=
0
;
sa
.
sa_flags
=
0
;
sigemptyset
(
&
sa
.
sa_mask
);
sa
.
sa_handler
=
SIG_IGN
;
sa
.
sa_handler
=
SIG_IGN
;
sa
.
sa_sigaction
=
NULL
;
while
(
sigaction
(
SIGPIPE
,
&
sa
,
NULL
)
<
0
&&
errno
==
EINTR
);
while
(
sigaction
(
SIGPIPE
,
&
sa
,
NULL
)
<
0
&&
errno
==
EINTR
);
sa
.
sa_handler
=
chldSigHandler
;
sa
.
sa_handler
=
chldSigHandler
;
while
(
sigaction
(
SIGCHLD
,
&
sa
,
NULL
)
<
0
&&
errno
==
EINTR
);
while
(
sigaction
(
SIGCHLD
,
&
sa
,
NULL
)
<
0
&&
errno
==
EINTR
);
...
@@ -97,16 +95,13 @@ void setSigHandlersForDecoder() {
...
@@ -97,16 +95,13 @@ void setSigHandlersForDecoder() {
finishSigHandlers
();
finishSigHandlers
();
sa
.
sa_flags
=
0
;
sa
.
sa_flags
=
0
;
sigemptyset
(
&
sa
.
sa_mask
);
sa
.
sa_handler
=
SIG_IGN
;
sa
.
sa_handler
=
SIG_IGN
;
sa
.
sa_sigaction
=
NULL
;
while
(
sigaction
(
SIGHUP
,
&
sa
,
NULL
)
<
0
&&
errno
==
EINTR
);
while
(
sigaction
(
SIGHUP
,
&
sa
,
NULL
)
<
0
&&
errno
==
EINTR
);
sa
.
sa_handler
=
NULL
;
while
(
sigaction
(
SIGINT
,
&
sa
,
NULL
)
<
0
&&
errno
==
EINTR
)
;
sa
.
sa_flags
=
SA_SIGINFO
;
sa
.
sa_flags
=
SA_SIGINFO
;
sa
.
sa_sigaction
=
decodeSigHandler
;
sa
.
sa_sigaction
=
decodeSigHandler
;
while
(
sigaction
(
SIGCHLD
,
&
sa
,
NULL
)
<
0
&&
errno
==
EINTR
);
while
(
sigaction
(
SIGCHLD
,
&
sa
,
NULL
)
<
0
&&
errno
==
EINTR
);
while
(
sigaction
(
SIGTERM
,
&
sa
,
NULL
)
<
0
&&
errno
==
EINTR
);
while
(
sigaction
(
SIGTERM
,
&
sa
,
NULL
)
<
0
&&
errno
==
EINTR
);
while
(
sigaction
(
SIGINT
,
&
sa
,
NULL
)
<
0
&&
errno
==
EINTR
);
}
}
void
ignoreSignals
()
{
void
ignoreSignals
()
{
...
...
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