From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28859 invoked by alias); 11 Dec 2012 14:58:56 -0000 Received: (qmail 28847 invoked by uid 22791); 11 Dec 2012 14:58:55 -0000 X-SWARE-Spam-Status: No, hits=-4.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-bk0-f41.google.com (HELO mail-bk0-f41.google.com) (209.85.214.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 11 Dec 2012 14:58:50 +0000 Received: by mail-bk0-f41.google.com with SMTP id jg9so1840000bkc.0 for ; Tue, 11 Dec 2012 06:58:48 -0800 (PST) Received: by 10.204.157.26 with SMTP id z26mr6412943bkw.101.1355237928816; Tue, 11 Dec 2012 06:58:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.204.226.140 with HTTP; Tue, 11 Dec 2012 06:58:08 -0800 (PST) In-Reply-To: <50C745A9.50700@redhat.com> References: <87txryx36w.fsf@fleche.redhat.com> <50C1BD45.9080709@redhat.com> <87zk1lel8o.fsf@fleche.redhat.com> <50C70C60.6080707@redhat.com> <50C745A9.50700@redhat.com> From: Hui Zhu Date: Tue, 11 Dec 2012 14:58:00 -0000 Message-ID: Subject: Re: [PATCH] Add fseek to ui-file To: Pedro Alves Cc: Tom Tromey , gdb-patches ml , Hui Zhu Content-Type: text/plain; charset=ISO-8859-1 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: 2012-12/txt/msg00332.txt.bz2 On Tue, Dec 11, 2012 at 10:39 PM, Pedro Alves wrote: > On 12/11/2012 02:34 PM, Hui Zhu wrote: > >> What about add a flag to struct stdio_file to record the error in this fd. >> When stdio_file_xxx get error, set it and throw error. >> Each stdio_file_xxx function check this flag before do syscall. If >> this fd get error, just return. > > That would allow the second caller to proceed as if no error > had happened. That's not a good interface. > > -- > Pedro Alves > What about change it to if flag is set, not do anything like current what we do. If not, throw error. For example: if (write (stdio->fd, buf, length_buf) < 0) { if (!stdio->error_throwed) { stdio->error_throwed = 1; error(xxx); } } No infinite recursion. Thanks, Hui