Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp3282082rwb; Mon, 5 Sep 2022 09:04:28 -0700 (PDT) X-Google-Smtp-Source: AA6agR71F4iYMGIW7+CVi12z8UNEXuJu6HcfYLXCoNt0r9Ap/jQVJgYPH+mMtYnqC6ic6fbA+nzV X-Received: by 2002:a17:907:3da2:b0:731:55b2:1c20 with SMTP id he34-20020a1709073da200b0073155b21c20mr35191249ejc.742.1662393868320; Mon, 05 Sep 2022 09:04:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662393868; cv=none; d=google.com; s=arc-20160816; b=pVe9f7l32E4wNhriPsJO6pmXQ2pGKeGZJCvI+AN6XZtIa8GqhaTf4oE45dskdVuOjc k1ZhLuoWTY/gHsug0wsw+zy0i3wUt1QbN3A8vSQS64F/3R2NXPeKtOyHKtRXSUWKaEkW thY4D+pUc0hSdpCOMAwy7Vb4fYzkLXp7mr2LIoZljXSnDiCEsSHfKz30bt3lcz2LZEQw nJ0F2xY7RW2d4rq+xP0lKMr1qDmFWTbNePSA1Mzv3x4kqpiME/3nXGejYYAnIkNQ3Ihw xf7j1shIJ9EL03abh02SD1RjZmMaJSELkc7RVQfPmBZCkaTdJ0ltgr5NbT6uLzfHDFuk xRHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:user-agent:date:message-id:subject:from:cc:to; bh=Xg6S0bUXOvCSpPDvcDNsfIcDbwSRj5yaQTRAEQPwEYc=; b=Ghbp4REpJw+cSrdqpk8gOBPu2UN3KZuH0ZqhbqugCzOX9FBCMrneFtSVvpitq776Rw aLHIB69jYPcyjohj+j+Al4GxUh/cbWM7rmhw0nFuQlEga/3Syn0qucmAR0cNP3JkXnBx YyELMXkZ4p3ho1ap6mUxTuYTjUWG/Luu4+eE+5yWM1JuaydxtbfNU6Oo055Kvqrcwc3+ wEC1YNbgKed52YDHRURzTQea2YFC64yisDTO4y4Tt9Xoq1j7JhkFpQ80OH9uSfQYa+o4 VNxRzAyfUnj7PtPWdopr73VNZyxIgF0/op1EujxTkaIQvW4TnQ5W6H5yFm2M2Q9Q6/LJ dH6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y13-20020a50eb8d000000b0044e8dd8a7c2si1942187edr.138.2022.09.05.09.03.54; Mon, 05 Sep 2022 09:04:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237446AbiIEPkJ (ORCPT + 99 others); Mon, 5 Sep 2022 11:40:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237013AbiIEPkI (ORCPT ); Mon, 5 Sep 2022 11:40:08 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84BB711839 for ; Mon, 5 Sep 2022 08:40:06 -0700 (PDT) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MLszW3p8wzZcKr; Mon, 5 Sep 2022 23:35:35 +0800 (CST) Received: from kwepemm600003.china.huawei.com (7.193.23.202) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 5 Sep 2022 23:40:03 +0800 Received: from [127.0.0.1] (10.174.177.249) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 5 Sep 2022 23:40:03 +0800 To: "Theodore Y. Ts'o" , Ext4 Developers List CC: linfeilong , wuguanghao From: Zhiqiang Liu Subject: [PATCH] tune2fs: tune2fs_main() should return rc when some error, occurs Message-ID: <7a6e1a43-d041-c3cf-a3dd-a9761d8dd4d6@huawei.com> Date: Mon, 5 Sep 2022 23:40:01 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.249] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org If some error occurs, tune2fs_main() will go to closefs tag for releasing resource, and it should return correct value (rc) instead of 0 when ext2fs_close_free(&fs) successes. Signed-off-by: Zhiqiang Liu --- misc/tune2fs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/misc/tune2fs.c b/misc/tune2fs.c index 25ade2fa..088f87e5 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -3481,6 +3481,7 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n" fputs(_("Error in using clear_mmp. " "It must be used with -f\n"), stderr); + rc = 1; goto closefs; } } @@ -3744,5 +3745,5 @@ closefs: if (feature_64bit) convert_64bit(fs, feature_64bit); - return (ext2fs_close_free(&fs) ? 1 : 0); + return (ext2fs_close_free(&fs) ? 1 : rc); } -- 2.33.0