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
1cb7c4bf
Commit
1cb7c4bf
authored
May 03, 2018
by
Vladislav Vaintroub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-16084 Calling exit() from a signal handler is unsafe.
Call _exit() from signal handler. main() can just do return.
parent
a411910d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
mysql-test/lib/My/SafeProcess/safe_process.cc
mysql-test/lib/My/SafeProcess/safe_process.cc
+6
-8
No files found.
mysql-test/lib/My/SafeProcess/safe_process.cc
View file @
1cb7c4bf
...
...
@@ -89,7 +89,7 @@ static void die(const char* fmt, ...)
}
static
void
kill_child
(
bool
was_killed
)
static
int
kill_child
(
bool
was_killed
)
{
int
status
=
0
;
...
...
@@ -108,15 +108,15 @@ static void kill_child(bool was_killed)
exit_code
=
WEXITSTATUS
(
status
);
message
(
"Child exit: %d"
,
exit_code
);
// Exit with exit status of the child
exit
(
exit_code
)
;
return
exit_code
;
}
if
(
WIFSIGNALED
(
status
))
message
(
"Child killed by signal: %d"
,
WTERMSIG
(
status
));
exit
(
exit_code
)
;
return
exit_code
;
}
exit
(
5
)
;
return
5
;
}
...
...
@@ -136,7 +136,7 @@ extern "C" void handle_signal(int sig)
terminated
=
1
;
if
(
child_pid
>
0
)
kill_child
(
sig
==
SIGCHLD
);
_exit
(
kill_child
(
sig
==
SIGCHLD
)
);
// Ignore further signals
signal
(
SIGTERM
,
SIG_IGN
);
...
...
@@ -292,8 +292,6 @@ int main(int argc, char* const argv[] )
/* Wait for parent or child to die */
sleep
(
1
);
}
kill_child
(
0
);
return
4
;
return
kill_child
(
0
);
}
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