libSegFault: Fix printing signal number [BZ #27249]
Commit Message
Signal number is written into the tail of buf, but printed from the
beginning, outputting garbage on the screen. Print from the correct
position.
---
debug/segfault.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 01/02/2021 17:04, Vitaly Chikunov wrote:
> Signal number is written into the tail of buf, but printed from the
> beginning, outputting garbage on the screen. Print from the correct
> position.
LGTM, thanks.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> ---
> debug/segfault.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/debug/segfault.c b/debug/segfault.c
> index 0a6be8b9d4..1873022db9 100644
> --- a/debug/segfault.c
> +++ b/debug/segfault.c
> @@ -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);
> }
>
>
>
On Mon, Feb 01, 2021 at 06:00:30PM -0300, Adhemerval Zanella via Libc-alpha wrote:
> On 01/02/2021 17:04, Vitaly Chikunov wrote:
> > Signal number is written into the tail of buf, but printed from the
> > beginning, outputting garbage on the screen. Print from the correct
> > position.
>
> LGTM, thanks.
>
> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Applied, thanks!
> > ---
> > debug/segfault.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/debug/segfault.c b/debug/segfault.c
> > index 0a6be8b9d4..1873022db9 100644
> > --- a/debug/segfault.c
> > +++ b/debug/segfault.c
> > @@ -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);
> > }
@@ -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);
}