From patchwork Wed Sep 12 07:39:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Su Yanjun X-Patchwork-Id: 10596907 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 DB33E921 for ; Wed, 12 Sep 2018 07:39:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CAF2F2979B for ; Wed, 12 Sep 2018 07:39:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BEE35297B1; Wed, 12 Sep 2018 07:39:28 +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 2629B2979B for ; Wed, 12 Sep 2018 07:39:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726555AbeILMml (ORCPT ); Wed, 12 Sep 2018 08:42:41 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:52558 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726442AbeILMml (ORCPT ); Wed, 12 Sep 2018 08:42:41 -0400 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="44815160" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 12 Sep 2018 15:39:23 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id 42D974B69E01 for ; Wed, 12 Sep 2018 15:39:22 +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; Wed, 12 Sep 2018 15:39:26 +0800 From: Su Yanjun To: CC: Su Yanjun Subject: [PATCH] btrfs-progs: change filename limit to 255 when creating subvolume Date: Wed, 12 Sep 2018 15:39:03 +0800 Message-ID: <20180912073903.10134-1-suyj.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-yoursite-MailScanner-ID: 42D974B69E01.AC378 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. Issue: #145 Signed-off-by: Su Yanjun --- cmds-subvolume.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmds-subvolume.c b/cmds-subvolume.c index e7a884af..fe97fca3 100644 --- a/cmds-subvolume.c +++ b/cmds-subvolume.c @@ -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; }