From patchwork Mon Feb 1 20:04:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitaly Chikunov X-Patchwork-Id: 41887 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3CE36394B017; Mon, 1 Feb 2021 20:04:26 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from vmicros1.altlinux.org (vmicros1.altlinux.org [194.107.17.57]) by sourceware.org (Postfix) with ESMTP id 70AF1394EC1B for ; Mon, 1 Feb 2021 20:04:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 70AF1394EC1B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=altlinux.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=vt@altlinux.org Received: from imap.altlinux.org (imap.altlinux.org [194.107.17.38]) by vmicros1.altlinux.org (Postfix) with ESMTP id 84C3B72C8B1 for ; Mon, 1 Feb 2021 23:04:22 +0300 (MSK) Received: from beacon.altlinux.org (unknown [193.43.10.250]) by imap.altlinux.org (Postfix) with ESMTPSA id 52A214A4712; Mon, 1 Feb 2021 23:04:22 +0300 (MSK) From: Vitaly Chikunov To: libc-alpha@sourceware.org Subject: [PATCH] libSegFault: Fix printing signal number [BZ #27249] Date: Mon, 1 Feb 2021 23:04:08 +0300 Message-Id: <20210201200408.1030278-1-vt@altlinux.org> X-Mailer: git-send-email 2.11.0 X-Spam-Status: No, score=-10.4 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vitaly Chikunov Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Signal number is written into the tail of buf, but printed from the beginning, outputting garbage on the screen. Print from the correct position. Reviewed-by: Adhemerval Zanella --- 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); }