From: TARUISI Hiroaki <taruishi.hiroak@jp.fujitsu.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH] btrfs-progs: check slash in deleting subvolumes.
Date: Thu, 24 Dec 2009 12:04:20 +0900 [thread overview]
Message-ID: <4B32DA34.7030101@jp.fujitsu.com> (raw)
For now, btrfsctl does not check whether subvolume name contains slash
or not. If someone specify subvolume with trailing slash (in case
using shell completion), ioctl returns with EINVAL and this error
may confuse some careless users like me. So, this patch adds check
slashes in subvolume name in deletion same as snapshot/subvolume
creating. But considering shell completion, this fix allows trailing
slash.
Regards,
taruisi
Signed-off-by: TARUISI Hiroaki <taruishi.hiroak@jp.fujitsu.com>
---
btrfsctl.c | 11 +++++++++++
1 file changed, 11 insertions(+)
Index: b/btrfsctl.c
===================================================================
--- a/btrfsctl.c 2009-12-24 11:40:15.000000000 +0900
+++ b/btrfsctl.c 2009-12-24 11:38:51.000000000 +0900
@@ -266,6 +266,7 @@ int main(int ac, char **av)
unsigned long command = 0;
int len;
char *fullpath;
+ char *pos;
if (ac == 2 && strcmp(av[1], "-a") == 0) {
fprintf(stderr, "Scanning for Btrfs filesystems\n");
@@ -332,6 +333,16 @@ int main(int ac, char **av)
command = BTRFS_IOC_SNAP_DESTROY;
name = av[i + 1];
len = strlen(name);
+ pos = strchr(name, '/');
+ if (pos) {
+ if (*(pos + 1) == '\0')
+ *(pos) = '\0';
+ else {
+ fprintf(stderr,
+ "error: / not allowed in names\n");
+ exit(1);
+ }
+ }
if (len == 0 || len >= BTRFS_VOL_NAME_MAX) {
fprintf(stderr, "-D size too long\n");
exit(1);
reply other threads:[~2009-12-24 3:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B32DA34.7030101@jp.fujitsu.com \
--to=taruishi.hiroak@jp.fujitsu.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.