From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24068 invoked by alias); 15 May 2011 02:59:52 -0000 Received: (qmail 24060 invoked by uid 22791); 15 May 2011 02:59:51 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST X-Spam-Check-By: sourceware.org Received: from mail-fx0-f41.google.com (HELO mail-fx0-f41.google.com) (209.85.161.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 15 May 2011 02:59:37 +0000 Received: by fxm18 with SMTP id 18so3057515fxm.0 for ; Sat, 14 May 2011 19:59:36 -0700 (PDT) Received: by 10.223.77.4 with SMTP id e4mr3692725fak.51.1305428376163; Sat, 14 May 2011 19:59:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.105.74 with HTTP; Sat, 14 May 2011 19:59:16 -0700 (PDT) In-Reply-To: <20110514171204.GE19356@adacore.com> References: <20110514171204.GE19356@adacore.com> From: Hui Zhu Date: Sun, 15 May 2011 02:59:00 -0000 Message-ID: Subject: Re: [OB] Fix build error in ui-file.c To: Joel Brobecker Cc: gdb-patches ml Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-05/txt/msg00346.txt.bz2 Hi Joel, What about add comments like other functions in this file? static void stdio_file_write (struct ui_file *file, const char *buf, long length_buf) { struct stdio_file *stdio =3D ui_file_data (file); if (stdio->magic !=3D &stdio_file_magic) internal_error (__FILE__, __LINE__, _("stdio_file_write: bad magic number")); /* Calling error crashes when we are called from the exception framework.= */ if (fwrite (buf, length_buf, 1, stdio->file)) ; } Thanks, Hui On Sun, May 15, 2011 at 01:12, Joel Brobecker wrote: >> Fix it like others in this file. >> >> 2011-05-14 =A0Hui Zhu =A0 >> >> =A0 =A0 =A0 * ui-file.c (stdio_file_write_async_safe): Add empty check f= or build. > > Personally, I think we're just sweeping the problem under the rug. > I'd rather have something like this: > >> - =A0write (stdio->fd, buf, length_buf); >> + =A0if (write (stdio->fd, buf, length_buf)) >> + =A0 =A0; > > =A0 =A0if (write (stdio->fd, buf, length_buf) < 0) > =A0 =A0 =A0/* Ignore this error *because*... */; > > -- > Joel >