openrc-run: avoid malloc inside sig-handler
same rational as 459783bb
Bug: https://github.com/OpenRC/openrc/issues/589
This commit is contained in:
parent
db96295e00
commit
5858f980c8
@ -108,7 +108,7 @@ static void
|
|||||||
handle_signal(int sig)
|
handle_signal(int sig)
|
||||||
{
|
{
|
||||||
int serrno = errno;
|
int serrno = errno;
|
||||||
char *signame = NULL;
|
const char *signame = NULL;
|
||||||
struct winsize ws;
|
struct winsize ws;
|
||||||
|
|
||||||
switch (sig) {
|
switch (sig) {
|
||||||
@ -134,20 +134,19 @@ handle_signal(int sig)
|
|||||||
|
|
||||||
case SIGINT:
|
case SIGINT:
|
||||||
if (!signame)
|
if (!signame)
|
||||||
xasprintf(&signame, "SIGINT");
|
signame = "SIGINT";
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
if (!signame)
|
if (!signame)
|
||||||
xasprintf(&signame, "SIGTERM");
|
signame = "SIGTERM";
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case SIGQUIT:
|
case SIGQUIT:
|
||||||
if (!signame)
|
if (!signame)
|
||||||
xasprintf(&signame, "SIGQUIT");
|
signame = "SIGQUIT";
|
||||||
/* Send the signal to our children too */
|
/* Send the signal to our children too */
|
||||||
if (service_pid > 0)
|
if (service_pid > 0)
|
||||||
kill(service_pid, sig);
|
kill(service_pid, sig);
|
||||||
eerror("%s: caught %s, aborting", applet, signame);
|
eerror("%s: caught %s, aborting", applet, signame);
|
||||||
free(signame);
|
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user