Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
0ad57d7a
Commit
0ad57d7a
authored
Mar 04, 2008
by
msvensson@pilot.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't ignore SIGCHLD since that affects waitpid on some platforms
Fix spelling error Move exit_code into local scope
parent
05e89c1f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
mysql-test/lib/My/SafeProcess/safe_process.cc
mysql-test/lib/My/SafeProcess/safe_process.cc
+6
-7
No files found.
mysql-test/lib/My/SafeProcess/safe_process.cc
View file @
0ad57d7a
...
@@ -89,7 +89,6 @@ static void die(const char* fmt, ...)
...
@@ -89,7 +89,6 @@ static void die(const char* fmt, ...)
static
void
kill_child
(
void
)
static
void
kill_child
(
void
)
{
{
int
exit_code
=
1
;
int
status
=
0
;
int
status
=
0
;
message
(
"Killing child: %d"
,
child_pid
);
message
(
"Killing child: %d"
,
child_pid
);
...
@@ -99,6 +98,7 @@ static void kill_child (void)
...
@@ -99,6 +98,7 @@ static void kill_child (void)
pid_t
ret_pid
=
waitpid
(
child_pid
,
&
status
,
0
);
pid_t
ret_pid
=
waitpid
(
child_pid
,
&
status
,
0
);
if
(
ret_pid
==
child_pid
)
if
(
ret_pid
==
child_pid
)
{
{
int
exit_code
=
1
;
if
(
WIFEXITED
(
status
))
if
(
WIFEXITED
(
status
))
{
{
// Process has exited, collect return status
// Process has exited, collect return status
...
@@ -113,7 +113,7 @@ static void kill_child (void)
...
@@ -113,7 +113,7 @@ static void kill_child (void)
exit
(
exit_code
);
exit
(
exit_code
);
}
}
exit
(
exit_code
);
exit
(
1
);
}
}
...
@@ -122,13 +122,12 @@ static void handle_signal (int sig)
...
@@ -122,13 +122,12 @@ static void handle_signal (int sig)
message
(
"Got signal %d, child_pid: %d"
,
sig
,
child_pid
);
message
(
"Got signal %d, child_pid: %d"
,
sig
,
child_pid
);
terminated
=
1
;
terminated
=
1
;
if
(
child_pid
>
0
)
kill_child
();
// Ignore further signals
// Ignore further signals
signal
(
SIGTERM
,
SIG_IGN
);
signal
(
SIGTERM
,
SIG_IGN
);
signal
(
SIGINT
,
SIG_IGN
);
signal
(
SIGINT
,
SIG_IGN
);
signal
(
SIGCHLD
,
SIG_IGN
);
if
(
child_pid
>
0
)
kill_child
();
// Continune execution, allow the child to be started and
// Continune execution, allow the child to be started and
// finally terminated by monitor loop
// finally terminated by monitor loop
...
@@ -237,7 +236,7 @@ int main(int argc, char* const argv[] )
...
@@ -237,7 +236,7 @@ int main(int argc, char* const argv[] )
break
;
break
;
}
}
// Check if child has exited, normally this wil be
// Check if child has exited, normally this wil
l
be
// detected immediately with SIGCHLD handler
// detected immediately with SIGCHLD handler
int
status
=
0
;
int
status
=
0
;
pid_t
ret_pid
=
waitpid
(
child_pid
,
&
status
,
WNOHANG
);
pid_t
ret_pid
=
waitpid
(
child_pid
,
&
status
,
WNOHANG
);
...
...
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