]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: config: report missing peers section name
authorWilly Tarreau <w@1wt.eu>
Tue, 5 Mar 2013 10:31:55 +0000 (11:31 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 6 Mar 2013 18:08:26 +0000 (19:08 +0100)
Right now we report "invalid character ''" which is a bit confusing,
better make a special case of the missing name.

src/cfgparse.c

index db2b21db459040412c2533f3b277b6dacbf4feea..c11c30a5f72e448a0b8184458b49783f5d6b0ae1 100644 (file)
@@ -1454,12 +1454,18 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
        int err_code = 0;
 
        if (strcmp(args[0], "peers") == 0) { /* new peers section */
+               if (!*args[1]) {
+                       Alert("parsing [%s:%d] : missing name for peers section.\n", file, linenum);
+                       err_code |= ERR_ALERT | ERR_FATAL;
+                       goto out;
+               }
 
                err = invalid_char(args[1]);
                if (err) {
                        Alert("parsing [%s:%d] : character '%c' is not permitted in '%s' name '%s'.\n",
                              file, linenum, *err, args[0], args[1]);
                        err_code |= ERR_ALERT | ERR_FATAL;
+                       goto out;
                }
 
                for (curpeers = peers; curpeers != NULL; curpeers = curpeers->next) {