From patchwork Tue Sep 18 01:17:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Su Yanjun X-Patchwork-Id: 10603625 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7524C1508 for ; Tue, 18 Sep 2018 01:18:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62B7F2A223 for ; Tue, 18 Sep 2018 01:18:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54A652A807; Tue, 18 Sep 2018 01:18:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1DD42A223 for ; Tue, 18 Sep 2018 01:18:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726791AbeIRGsU (ORCPT ); Tue, 18 Sep 2018 02:48:20 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:48803 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725859AbeIRGsU (ORCPT ); Tue, 18 Sep 2018 02:48:20 -0400 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="45023473" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 18 Sep 2018 09:18:18 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id 054194B41ED3 for ; Tue, 18 Sep 2018 09:18:16 +0800 (CST) Received: from localhost.localdomain (10.167.226.155) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server id 14.3.408.0; Tue, 18 Sep 2018 09:18:20 +0800 From: Su Yanjun To: CC: Su Yanjun Subject: [PATCH v2] btrfs-progs: change filename limit to 255 when creating subvolume Date: Tue, 18 Sep 2018 09:17:54 +0800 Message-ID: <20180918011754.7981-1-suyj.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-yoursite-MailScanner-ID: 054194B41ED3.AC770 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: suyj.fnst@cn.fujitsu.com Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Modify the file name length limit to meet the Linux naming convention. In addition, the file name length is always bigger than 0, no need to compare with 0 again. Changelog: v2: Fix the same problem in creating snapshot routine. Issue: #145 Signed-off-by: Su Yanjun --- v2: Also fix the same problem in creating snapshot routine. cmds-subvolume.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmds-subvolume.c b/cmds-subvolume.c index e7a884af1f5d..5a446c1ae2b4 100644 --- a/cmds-subvolume.c +++ b/cmds-subvolume.c @@ -155,7 +155,7 @@ static int cmd_subvol_create(int argc, char **argv) } len = strlen(newname); - if (len == 0 || len >= BTRFS_VOL_NAME_MAX) { + if (len > BTRFS_VOL_NAME_MAX) { error("subvolume name too long: %s", newname); goto out; } @@ -715,7 +715,7 @@ static int cmd_subvol_snapshot(int argc, char **argv) } len = strlen(newname); - if (len == 0 || len >= BTRFS_VOL_NAME_MAX) { + if (len > BTRFS_VOL_NAME_MAX) { error("snapshot name too long '%s'", newname); goto out; }