]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: ring: support unit suffixes in the size
authorWilly Tarreau <w@1wt.eu>
Tue, 19 Nov 2024 09:56:45 +0000 (10:56 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 19 Nov 2024 09:56:45 +0000 (10:56 +0100)
The ring size used to take only numbers and silently ignore letters (due
to atol()), resulting it tiny buffers when trying to collect traces and
using e.g. "size 10g". Let's make use of parse_size_err() to properly
parse units.

src/sink.c

index 0b951838838f8233aeabd6145a2b9121b71c4647..b86c336bcdd875c3d514c4dd039c51600a69b05f 100644 (file)
@@ -976,8 +976,7 @@ int cfg_parse_ring(const char *file, int linenum, char **args, int kwm)
                        goto err;
                }
 
-               size = atol(args[1]);
-               if (!size) {
+               if (parse_size_err(args[1], &size) != NULL || !size) {
                        ha_alert("parsing [%s:%d] : invalid size '%s' for new sink buffer.\n", file, linenum, args[1]);
                        err_code |= ERR_ALERT | ERR_FATAL;
                        goto err;