libSegFault: Fix printing signal number [BZ #27249]

Signal number is written into the tail of buf, but printed from the
beginning, outputting garbage on the screen.  Fix this by printing
from the correct position.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
This commit is contained in:
Vitaly Chikunov 2021-02-01 23:04:08 +03:00 committed by Dmitry V. Levin
parent fd4405747c
commit f9be44c7e6

View File

@ -58,7 +58,7 @@ write_strsignal (int fd, int signal)
char buf[30];
char *ptr = _itoa_word (signal, &buf[sizeof (buf)], 10, 0);
WRITE_STRING ("signal ");
write (fd, buf, &buf[sizeof (buf)] - ptr);
write (fd, ptr, &buf[sizeof (buf)] - ptr);
}