From patchwork Wed Aug 6 10:12:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary Benson X-Patchwork-Id: 2318 Received: (qmail 18539 invoked by alias); 6 Aug 2014 10:12:44 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 18341 invoked by uid 89); 6 Aug 2014 10:12:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 06 Aug 2014 10:12:37 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s76ACawx019217 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 6 Aug 2014 06:12:36 -0400 Received: from blade.nx (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s76ACZSG014737 for ; Wed, 6 Aug 2014 06:12:36 -0400 Received: from blade.nx (localhost [127.0.0.1]) by blade.nx (Postfix) with ESMTP id 18F372640E1 for ; Wed, 6 Aug 2014 11:12:35 +0100 (BST) From: Gary Benson To: gdb-patches@sourceware.org Subject: [PATCH 4/8] Replace hardwired error handlers in tui_initialize_io Date: Wed, 6 Aug 2014 11:12:24 +0100 Message-Id: <1407319948-2264-5-git-send-email-gbenson@redhat.com> In-Reply-To: <1407319948-2264-1-git-send-email-gbenson@redhat.com> References: <1407319948-2264-1-git-send-email-gbenson@redhat.com> X-IsSubscribed: yes tui_initialize_io contains a pair of hardwired fprintf/exit error handlers. I was unable to find any documentation as to why they're hardwired (the code appeared in a monolithic block back in 2001: https://sourceware.org/ml/gdb-patches/2001-07/msg00490.html) and I was also unable to come up with a situation where error would not be suitable, so I have replaced both handlers with calls to error. gdb/ 2014-08-05 Gary Benson * tui/tui-io.c (tui_initialize_io): Replace two fprintf/exit pairs with calls to error. Wrap the message with _(). --- gdb/ChangeLog | 5 +++++ gdb/tui/tui-io.c | 12 ++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c index 75eb4b8..11b2366 100644 --- a/gdb/tui/tui-io.c +++ b/gdb/tui/tui-io.c @@ -617,16 +617,12 @@ tui_initialize_io (void) readline output in a pipe, read that pipe and output the content in the curses command window. */ if (gdb_pipe_cloexec (tui_readline_pipe) != 0) - { - fprintf_unfiltered (gdb_stderr, "Cannot create pipe for readline"); - exit (1); - } + error (_("Cannot create pipe for readline")); + tui_rl_outstream = fdopen (tui_readline_pipe[1], "w"); if (tui_rl_outstream == 0) - { - fprintf_unfiltered (gdb_stderr, "Cannot redirect readline output"); - exit (1); - } + error (_("Cannot redirect readline output")); + setvbuf (tui_rl_outstream, (char*) NULL, _IOLBF, 0); #ifdef O_NONBLOCK