Author: jh
Date: Wed Dec  1 19:24:07 2010
New Revision: 216098
URL: http://svn.freebsd.org/changeset/base/216098

Log:
  - 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

Modified:
  head/sys/geom/label/g_label.c

Modified: head/sys/geom/label/g_label.c
==============================================================================
--- head/sys/geom/label/g_label.c       Wed Dec  1 15:31:31 2010        
(r216097)
+++ head/sys/geom/label/g_label.c       Wed Dec  1 19:24:07 2010        
(r216098)
@@ -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, str
                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,
                return;
        }
        if (*nargs != 2) {
-               gctl_error(req, "Invalid number of argument.");
+               gctl_error(req, "Invalid number of arguments.");
                return;
        }
        /*
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to