start-stop-daemon: avoid malloc inside sig-handler
same rational as 459783bb
Bug: https://github.com/OpenRC/openrc/issues/589
This commit is contained in:
parent
5858f980c8
commit
ae5e38dce5
@ -204,20 +204,20 @@ handle_signal(int sig)
|
||||
{
|
||||
int status;
|
||||
int serrno = errno;
|
||||
char *signame = NULL;
|
||||
const char *signame = NULL;
|
||||
|
||||
switch (sig) {
|
||||
case SIGINT:
|
||||
if (!signame)
|
||||
xasprintf(&signame, "SIGINT");
|
||||
signame = "SIGINT";
|
||||
/* FALLTHROUGH */
|
||||
case SIGTERM:
|
||||
if (!signame)
|
||||
xasprintf(&signame, "SIGTERM");
|
||||
signame = "SIGTERM";
|
||||
/* FALLTHROUGH */
|
||||
case SIGQUIT:
|
||||
if (!signame)
|
||||
xasprintf(&signame, "SIGQUIT");
|
||||
signame = "SIGQUIT";
|
||||
eerrorx("%s: caught %s, aborting", applet, signame);
|
||||
/* NOTREACHED */
|
||||
|
||||
@ -236,9 +236,6 @@ handle_signal(int sig)
|
||||
eerror("%s: caught unknown signal %d", applet, sig);
|
||||
}
|
||||
|
||||
/* free signame */
|
||||
free(signame);
|
||||
|
||||
/* Restore errno */
|
||||
errno = serrno;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user