btrfs-progs: change filename limit to 255 when creating subvolume

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 <suyj.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Su Yanjun 2018-09-18 09:17:54 +08:00 committed by David Sterba
parent 23eed7acfd
commit 3ea85fa886

View File

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