From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17657 invoked by alias); 22 Oct 2009 19:42:26 -0000 Received: (qmail 17634 invoked by uid 22791); 22 Oct 2009 19:42:25 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.115.85.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 22 Oct 2009 19:42:21 +0000 Received: from mailhost2.vmware.com (mailhost2.vmware.com [10.16.67.167]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 5DFB3130F0; Thu, 22 Oct 2009 12:42:20 -0700 (PDT) Received: from [10.20.94.141] (msnyder-server.eng.vmware.com [10.20.94.141]) by mailhost2.vmware.com (Postfix) with ESMTP id 3F4A38E834; Thu, 22 Oct 2009 12:42:20 -0700 (PDT) Message-ID: <4AE0B40B.5020802@vmware.com> Date: Thu, 22 Oct 2009 19:42:00 -0000 From: Michael Snyder User-Agent: Thunderbird 1.5.0.12 (X11/20080411) MIME-Version: 1.0 To: Hui Zhu CC: Eli Zaretskii , "gdb-patches@sourceware.org" Subject: Re: [RFA, 3 of 3] save/restore process record, part 3 (save/restore) References: <4AD91D72.1030802@vmware.com> <83my3phjew.fsf@gnu.org> <4ADA4191.4060404@vmware.com> <83k4ytgxh5.fsf@gnu.org> <4ADA93C9.5040601@vmware.com> <4ADCA7DC.5040006@vmware.com> <4ADE1612.9040708@vmware.com> <4ADE167F.2020309@vmware.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 2009-10/txt/msg00533.txt.bz2 Hui Zhu wrote: > On Wed, Oct 21, 2009 at 03:58, Michael Snyder wrote: >> Michael Snyder wrote: >>> Hui Zhu wrote: >>>> On Tue, Oct 20, 2009 at 01:54, Michael Snyder wrote: >>>>> Hui Zhu wrote: >>>>>> Hi Michael, >>>>>> >>>>>> I think you want unlink the gdb_record when save get some error. It >>>>>> maybe need "discard_cleanups" the old_cleanups and bfd_close (obfd); >>>>>> >>>>>> After change the code, everything is OK. >>>>> Yes. Thanks. Like this: >>>>> + if (record_list->prev) >>>>> + record_list = record_list->prev; >>>>> + } >>>>> + >>>>> + do_cleanups (set_cleanups); >>>>> + bfd_close (obfd); >>>>> + discard_cleanups (old_cleanups); >>>>> + >>>>> + /* Succeeded. */ >>>> I suggest: >>>> + discard_cleanups (old_cleanups); >>>> + bfd_close (obfd); >>> The reason I did the bfd_close first is because I wasn't >>> sure if it was safe to delete the file first. In any way, >>> it seems more logical to close the file before delete it. >> Oh, oops, never mind. My head's fuzzy today. >> >> Why do you suggest to change the order? >> Just curious, I don't have an issue with it... >> > > Sorry I didn't talk the function very clear. > >>>>> + bfd_close (obfd); >>>>> + discard_cleanups (old_cleanups); > Before "discard_cleanups (old_cleanups);", the "record_save_cleanups" > will be call sometime. "record_save_cleanups" will call "bfd_close > (obfd)". > If the record_save_cleanups will happen after "bfd_close (obfd)". > "bfd_close (obfd)" will be call twice. > > Of curse, most of time it will not happen. So I just suggest. :) OK, done and committed.