mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-27 00:22:22 +00:00
no slashes in subvolume names
This commit is contained in:
parent
38ef945266
commit
9ea6a6fd92
12
btrfsctl.c
12
btrfsctl.c
@ -38,6 +38,7 @@ int main(int ac, char **av)
|
||||
struct stat st;
|
||||
DIR *dirstream;
|
||||
unsigned long command = 0;
|
||||
int len;
|
||||
|
||||
for (i = 1; i < ac - 1; i++) {
|
||||
if (strcmp(av[i], "-s") == 0) {
|
||||
@ -46,8 +47,15 @@ int main(int ac, char **av)
|
||||
print_usage();
|
||||
}
|
||||
name = av[i + 1];
|
||||
if (strlen(name) >= BTRFS_VOL_NAME_MAX) {
|
||||
fprintf(stderr, "snapshot name is too long\n");
|
||||
len = strlen(name);
|
||||
if (len == 0 || len >= BTRFS_VOL_NAME_MAX) {
|
||||
fprintf(stderr,
|
||||
"snapshot name zero length or too long\n");
|
||||
exit(1);
|
||||
}
|
||||
if (strchr(name, '/')) {
|
||||
fprintf(stderr,
|
||||
"error: / not allowed in names\n");
|
||||
exit(1);
|
||||
}
|
||||
command = BTRFS_IOC_SNAP_CREATE;
|
||||
|
Loading…
Reference in New Issue
Block a user