signals: don't call a print routine in a signal handler

Print routines are not asynchronous-safe.

But... the only reason the call of kill() could return an error code
is when the relevant process has already terminated -- which is not
a problem, because that was the goal of calling kill().

This fixes https://savannah.gnu.org/bugs/?54409.
Reported-by: Daniel Kozovsky <dkozovsk@redhat.com>
master
Benno Schulenberg 2018-07-30 20:22:24 +02:00
parent 72a590d60a
commit 60ee4408be
1 changed files with 2 additions and 4 deletions

View File

@ -1088,12 +1088,10 @@ void do_enter(void)
}
#ifndef NANO_TINY
/* Send a SIGKILL (unconditional kill) to the forked process in
* execute_command(). */
/* Send an unconditional kill signal to the running external command. */
RETSIGTYPE cancel_the_command(int signal)
{
if (kill(pid_of_command, SIGKILL) == -1)
nperror("kill");
kill(pid_of_command, SIGKILL);
}
/* Send the text that starts at the given line to file descriptor fd. */