public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
To: newlib@sourceware.org
Subject: [PATCH] MSP430: Fix message in sbrk.c printing binary character
Date: Thu, 3 Sep 2020 11:23:30 +0100	[thread overview]
Message-ID: <20200903102330.wbk3tslabdrmvhtm@jozef-acer-manjaro> (raw)

[-- Attachment #1: Type: text/plain, Size: 277 bytes --]

The call to write() in sbrk.c was using the wrong value for the length
argument, causing the NUL terminating character of the string to be
printed.

If the patch is acceptable, I would appreciate if someone would commit
it for me, as I do not have write access.

Thanks,
Jozef

[-- Attachment #2: 0001-MSP430-Fix-message-in-sbrk.c-printing-binary-charact.patch --]
[-- Type: text/plain, Size: 919 bytes --]

From 36c92acd1d6f4bbce4dccf837bbd249b838cd908 Mon Sep 17 00:00:00 2001
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
Date: Wed, 2 Sep 2020 16:16:55 +0100
Subject: [PATCH] MSP430: Fix message in sbrk.c printing binary character

The call to write() in sbrk.c was using the wrong value for the length
argument, causing the NUL terminating character of the string to be
printed.

---
 libgloss/msp430/sbrk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libgloss/msp430/sbrk.c b/libgloss/msp430/sbrk.c
index bbc3fb5ba..8e4339f6e 100644
--- a/libgloss/msp430/sbrk.c
+++ b/libgloss/msp430/sbrk.c
@@ -24,8 +24,8 @@ _sbrk (int adj)
 
   if (heap + adj > sp)
     {
-#define MESSAGE "Heap and stack collision\n"
-      write (1, MESSAGE, sizeof MESSAGE);
+      const char * const msg = "Heap and stack collision\n";
+      write (1, msg, sizeof (msg) - 1);
       abort ();
     }
 
-- 
2.28.0


             reply	other threads:[~2020-09-03 10:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03 10:23 Jozef Lawrynowicz [this message]
2020-09-03 11:44 ` Corinna Vinschen
2020-09-03 12:14   ` Łukasz Żak
2020-09-03 13:02     ` Jozef Lawrynowicz
2020-09-04 13:05       ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200903102330.wbk3tslabdrmvhtm@jozef-acer-manjaro \
    --to=jozef.l@mittosystems.com \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).