]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: config: check the proper pointer to report unknown protocol
authorWilly Tarreau <w@1wt.eu>
Mon, 24 Sep 2012 20:47:39 +0000 (22:47 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 24 Sep 2012 20:49:06 +0000 (22:49 +0200)
Check the protocol pointer and not the socket to report an unknown family
in servers or peers. This can never happen anyway, it's just to be completely
clean.

src/cfgparse.c

index 7e4db74966c2417011d9b7ee5b54d7a3d34864d2..cd3a559d1d0726b1d3b480d3039d691a2af80c7a 100644 (file)
@@ -1309,7 +1309,7 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
                newpeer->data  = &raw_sock;
                newpeer->sock_init_arg = NULL;
 
-               if (!sk) {
+               if (!newpeer->proto) {
                        Alert("parsing [%s:%d] : Unknown protocol family %d '%s'\n",
                              file, linenum, newpeer->addr.ss_family, args[2]);
                        err_code |= ERR_ALERT | ERR_FATAL;
@@ -3951,7 +3951,7 @@ stats_error_parsing:
                        newsrv->proto = protocol_by_family(newsrv->addr.ss_family);
                        newsrv->data  = &raw_sock;
 
-                       if (!sk) {
+                       if (!newsrv->proto) {
                                Alert("parsing [%s:%d] : Unknown protocol family %d '%s'\n",
                                      file, linenum, newsrv->addr.ss_family, args[2]);
                                err_code |= ERR_ALERT | ERR_FATAL;