From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from vmicros1.altlinux.org (vmicros1.altlinux.org [194.107.17.57]) by sourceware.org (Postfix) with ESMTP id 2E369384A029 for ; Mon, 26 Apr 2021 20:04:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2E369384A029 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=altlinux.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=ldv@altlinux.org Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id A64E172C8B0 for ; Mon, 26 Apr 2021 23:04:45 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id 9B12F7CC8A7; Mon, 26 Apr 2021 23:04:45 +0300 (MSK) Date: Mon, 26 Apr 2021 20:00:00 +0000 From: "Dmitry V. Levin" To: debugedit@sourceware.org Subject: [PATCH 1/2] debugedit: strip extra newline characters from diagnostic messages Message-ID: <20210426200000.GA12328@altlinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: debugedit@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: debugedit development mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Apr 2021 20:04:47 -0000 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