public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] libSegFault: Fix printing signal number [BZ #27249]
@ 2021-02-01 20:04 Vitaly Chikunov
  2021-02-01 21:00 ` Adhemerval Zanella
  0 siblings, 1 reply; 3+ messages in thread
From: Vitaly Chikunov @ 2021-02-01 20:04 UTC (permalink / raw)
  To: libc-alpha; +Cc: Vitaly Chikunov

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(-)

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);
 }
 
 
-- 
2.11.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libSegFault: Fix printing signal number [BZ #27249]
  2021-02-01 20:04 [PATCH] libSegFault: Fix printing signal number [BZ #27249] Vitaly Chikunov
@ 2021-02-01 21:00 ` Adhemerval Zanella
  2021-02-02  0:37   ` Dmitry V. Levin
  0 siblings, 1 reply; 3+ messages in thread
From: Adhemerval Zanella @ 2021-02-01 21:00 UTC (permalink / raw)
  To: libc-alpha



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);
>  }
>  
>  
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libSegFault: Fix printing signal number [BZ #27249]
  2021-02-01 21:00 ` Adhemerval Zanella
@ 2021-02-02  0:37   ` Dmitry V. Levin
  0 siblings, 0 replies; 3+ messages in thread
From: Dmitry V. Levin @ 2021-02-02  0:37 UTC (permalink / raw)
  To: libc-alpha; +Cc: Vitaly Chikunov

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);
> >  }

-- 
ldv

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-02  0:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-01 20:04 [PATCH] libSegFault: Fix printing signal number [BZ #27249] Vitaly Chikunov
2021-02-01 21:00 ` Adhemerval Zanella
2021-02-02  0:37   ` Dmitry V. Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).