]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: log-format: fix return code of the function parse_logformat_var()
authorThierry FOURNIER / OZON.IO <thierry.fournier@ozon.io>
Tue, 22 Nov 2016 21:06:04 +0000 (22:06 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 24 Nov 2016 17:54:25 +0000 (18:54 +0100)
This patch replaces the successful return code from 0 to 1. The
error code is replaced from -1 to 0.

The return code of this function is actually unused, so this
patch cannot modify the behaviour.

src/log.c

index 4f7d78827abd7f72e1c938d77241631469a60449..3f2b011ea60f4d7fc5a0994db9788da8a72497c6 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -340,6 +340,7 @@ int parse_logformat_var_args(char *args, struct logformat_node *node)
  * must pass the args part in the <arg> pointer with its length in <arg_len>,
  * and varname with its length in <var> and <var_len> respectively. <arg> is
  * ignored when arg_len is 0. Neither <var> nor <var_len> may be null.
+ * Returns false in error case and err is filled, otherwise returns true.
  */
 int parse_logformat_var(char *arg, int arg_len, char *var, int var_len, struct proxy *curproxy, struct list *list_format, int *defoptions)
 {
@@ -368,7 +369,7 @@ int parse_logformat_var(char *arg, int arg_len, char *var, int var_len, struct p
                                } else {
                                        if (logformat_keywords[j].config_callback &&
                                            logformat_keywords[j].config_callback(node, curproxy) != 0) {
-                                               return -1;
+                                               return 0;
                                        }
                                        curproxy->to_log |= logformat_keywords[j].lw;
                                        LIST_ADDQ(list_format, &node->list);
@@ -377,12 +378,12 @@ int parse_logformat_var(char *arg, int arg_len, char *var, int var_len, struct p
                                        Warning("parsing [%s:%d] : deprecated variable '%s' in '%s', please replace it with '%s'.\n",
                                                curproxy->conf.args.file, curproxy->conf.args.line,
                                                logformat_keywords[j].name, fmt_directive(curproxy), logformat_keywords[j].replace_by);
-                               return 0;
+                               return 1;
                        } else {
                                Warning("parsing [%s:%d] : '%s' : format variable '%s' is reserved for HTTP mode.\n",
                                        curproxy->conf.args.file, curproxy->conf.args.line, fmt_directive(curproxy),
                                        logformat_keywords[j].name);
-                               return -1;
+                               return 0;
                        }
                }
        }
@@ -392,7 +393,7 @@ int parse_logformat_var(char *arg, int arg_len, char *var, int var_len, struct p
        Warning("parsing [%s:%d] : no such format variable '%s' in '%s'. If you wanted to emit the '%%' character verbatim, you need to use '%%%%' in log-format expressions.\n",
                curproxy->conf.args.file, curproxy->conf.args.line, var, fmt_directive(curproxy));
        var[var_len] = j;
-       return -1;
+       return 0;
 }
 
 /*