From patchwork Fri Dec 19 16:06:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Sterba X-Patchwork-Id: 5520551 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 858539F1CD for ; Fri, 19 Dec 2014 16:06:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CE3DC20142 for ; Fri, 19 Dec 2014 16:06:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BCDF42013D for ; Fri, 19 Dec 2014 16:06:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751730AbaLSQGd (ORCPT ); Fri, 19 Dec 2014 11:06:33 -0500 Received: from cantor2.suse.de ([195.135.220.15]:43114 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751678AbaLSQGd (ORCPT ); Fri, 19 Dec 2014 11:06:33 -0500 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 32E8AAC2E for ; Fri, 19 Dec 2014 16:06:32 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id A7BF1DAA27; Fri, 19 Dec 2014 17:06:31 +0100 (CET) From: David Sterba To: linux-btrfs@vger.kernel.org Cc: David Sterba Subject: [PATCH 3/6] btrfs-progs: fragments, close output file on error Date: Fri, 19 Dec 2014 17:06:31 +0100 Message-Id: X-Mailer: git-send-email 2.1.3 In-Reply-To: References: Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Resolves-Coverity-CID: 1258794 Signed-off-by: David Sterba Reviewed-by: Eric Sandeen --- btrfs-fragments.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/btrfs-fragments.c b/btrfs-fragments.c index d03c2c3e7319..360f10f87bfa 100644 --- a/btrfs-fragments.c +++ b/btrfs-fragments.c @@ -233,7 +233,7 @@ list_fragments(int fd, u64 flags, char *dir) ret = ioctl(fd, BTRFS_IOC_TREE_SEARCH, &args); if (ret < 0) { fprintf(stderr, "ERROR: can't perform the search\n"); - return ret; + goto out_close; } /* the ioctl returns the number of item it found in nr_items */ if (sk->nr_items == 0) @@ -373,7 +373,10 @@ skip:; fprintf(html, "

"); } fprintf(html, "\n"); - + +out_close: + fclose(html); + return ret; }