diff options
author | jh <jh@FreeBSD.org> | 2010-12-01 19:24:07 +0000 |
---|---|---|
committer | jh <jh@FreeBSD.org> | 2010-12-01 19:24:07 +0000 |
commit | 0a3bc2b1b96399af7fd4120eb826e426ede43530 (patch) | |
tree | e7c41bbdccdd19d7128578718659f82617917cfa /sys/geom/label | |
parent | 33ed69008df8b949df3749aec9a0b953bb966153 (diff) | |
download | FreeBSD-src-0a3bc2b1b96399af7fd4120eb826e426ede43530.zip FreeBSD-src-0a3bc2b1b96399af7fd4120eb826e426ede43530.tar.gz |
- Report an error when a label with invalid name is attempted to be
created with glabel(8).
- Fix a typo in an error message.
- Fix comment typos.
Approved by: pjd
Diffstat (limited to 'sys/geom/label')
-rw-r--r-- | sys/geom/label/g_label.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/geom/label/g_label.c b/sys/geom/label/g_label.c index 73054fa..c4582894 100644 --- a/sys/geom/label/g_label.c +++ b/sys/geom/label/g_label.c @@ -124,13 +124,13 @@ g_label_is_name_ok(const char *label) { const char *s; - /* Check is the label starts from ../ */ + /* Check if the label starts from ../ */ if (strncmp(label, "../", 3) == 0) return (0); - /* Check is the label contains /../ */ + /* Check if the label contains /../ */ if (strstr(label, "/../") != NULL) return (0); - /* Check is the label ends at ../ */ + /* Check if the label ends at ../ */ if ((s = strstr(label, "/..")) != NULL && s[3] == '\0') return (0); return (1); @@ -151,6 +151,8 @@ g_label_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp, G_LABEL_DEBUG(0, "%s contains suspicious label, skipping.", pp->name); G_LABEL_DEBUG(1, "%s suspicious label is: %s", pp->name, label); + if (req != NULL) + gctl_error(req, "Label name %s is invalid.", label); return (NULL); } gp = NULL; @@ -346,7 +348,7 @@ g_label_ctl_create(struct gctl_req *req, struct g_class *mp) return; } if (*nargs != 2) { - gctl_error(req, "Invalid number of argument."); + gctl_error(req, "Invalid number of arguments."); return; } /* |