[PATCH v2] btrfs-progs: change filename limit to 255 when creating subvolume

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <suyj.fnst@xxxxxxxxxxxxxx>
---

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;
 	}
-- 
2.18.0






[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux