public inbox for debugedit@sourceware.org
 help / color / mirror / Atom feed
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: debugedit@sourceware.org
Subject: [PATCH 1/2] debugedit: strip extra newline characters from diagnostic messages
Date: Mon, 26 Apr 2021 20:00:00 +0000	[thread overview]
Message-ID: <20210426200000.GA12328@altlinux.org> (raw)

Since the output produced by error() is already terminated by a newline
character, no newline terminating characters are needed in diagnostic
messages printed using error().

* tools/debugedit.c (main): Remove terminating newline characters from
format strings passed to error().
---
 tools/debugedit.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/debugedit.c b/tools/debugedit.c
index 4527a08..5d1644f 100644
--- a/tools/debugedit.c
+++ b/tools/debugedit.c
@@ -3538,7 +3538,7 @@ main (int argc, char *argv[])
 	  GElf_Shdr shdr_mem;
 	  GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
 	  if (shdr == NULL)
-	    error (1, 0, "Couldn't get shdr: %s\n", elf_errmsg (-1));
+	    error (1, 0, "Couldn't get shdr: %s", elf_errmsg (-1));
 
 	  /* Any sections we have changed aren't allocated sections,
 	     so we don't need to lookup any changed section sizes. */
@@ -3558,7 +3558,7 @@ main (int argc, char *argv[])
 	  GElf_Shdr shdr_mem;
 	  GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
 	  if (shdr == NULL)
-	    error (1, 0, "Couldn't get shdr: %s\n", elf_errmsg (-1));
+	    error (1, 0, "Couldn't get shdr: %s", elf_errmsg (-1));
 
 	  /* A bug in elfutils before 0.169 means we have to write out
 	     all section data, even when nothing changed.
@@ -3607,7 +3607,7 @@ main (int argc, char *argv[])
 		  shdr->sh_size = sec_size;
 		  shdr->sh_offset = sec_offset;
 		  if (gelf_update_shdr (scn, shdr) == 0)
-		    error (1, 0, "Couldn't update shdr: %s\n",
+		    error (1, 0, "Couldn't update shdr: %s",
 			   elf_errmsg (-1));
 		}
 	    }
@@ -3621,7 +3621,7 @@ main (int argc, char *argv[])
 	{
 	  dso->ehdr.e_shoff = new_offset;
 	  if (gelf_update_ehdr (elf, &dso->ehdr) == 0)
-	    error (1, 0, "Couldn't update ehdr: %s\n", elf_errmsg (-1));
+	    error (1, 0, "Couldn't update ehdr: %s", elf_errmsg (-1));
 	}
     }
 
-- 
ldv

             reply	other threads:[~2021-04-26 20:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-26 20:00 Dmitry V. Levin [this message]
2021-04-29 12:26 ` Mark Wielaard

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=20210426200000.GA12328@altlinux.org \
    --to=ldv@altlinux.org \
    --cc=debugedit@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).