From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55369) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvMOk-0003PE-5t for qemu-devel@nongnu.org; Fri, 13 Jun 2014 03:59:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WvMOd-0002N3-T6 for qemu-devel@nongnu.org; Fri, 13 Jun 2014 03:59:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:63712) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvMOd-0002Mt-Kj for qemu-devel@nongnu.org; Fri, 13 Jun 2014 03:59:35 -0400 Message-ID: <1402646365.21444.21.camel@nilsson.home.kraxel.org> From: Gerd Hoffmann Date: Fri, 13 Jun 2014 09:59:25 +0200 In-Reply-To: <539AAC98.8010902@redhat.com> References: <1402624000-4896-1-git-send-email-arei.gonglei@huawei.com> <87vbs5s2kc.fsf@blackfin.pond.sub.org> <539AAC98.8010902@redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] audio: Fix using freed pointer in wav_fini_out List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: weidong.huang@huawei.com, luonengjun@huawei.com, Markus Armbruster , qemu-devel@nongnu.org, arei.gonglei@huawei.com, stefanha@redhat.com On Fr, 2014-06-13 at 09:47 +0200, Paolo Bonzini wrote: > Il 13/06/2014 09:15, Markus Armbruster ha scritto: > > I'm afraid this is not an improvement. > > > > Your patch makes the code ignore fclose() failure silently. This is a > > common mistake. fclose() failure after write can mean data loss, and > > the user certainly needs to know about that. > > If you want that, the best solution is to first fflush() and then > fclose(). Agree. If you really care you'll go flush/sync before close, so you still have a valid file handle when you see the failure. Question is do we really need that here? This isn't your virtual disk, it's just a few audio samples which might get lost ... cheers, Gerd