]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: debug: debug_parse_cli_show_dev: use errname
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Sat, 21 Sep 2024 16:20:19 +0000 (18:20 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 24 Jan 2025 08:54:57 +0000 (09:54 +0100)
Let's use errname, introduced in the previous commit in the output of
"show dev". This output is destined to engineers. So, no need to provide a
long descriptions of errnos given by strerror.

src/debug.c

index 3b15007b88fbb8e35418d1b43f7289bea6b93e1c..6434106a9a4df11ec51ded918c6d6b7158847104 100644 (file)
@@ -542,6 +542,7 @@ static int debug_parse_cli_show_libs(char **args, char *payload, struct appctx *
 static int debug_parse_cli_show_dev(char **args, char *payload, struct appctx *appctx, void *private)
 {
        const char **build_opt;
+       char *err = NULL;
        int i;
 
        if (*args[2])
@@ -616,7 +617,7 @@ static int debug_parse_cli_show_dev(char **args, char *payload, struct appctx *a
                                             post_mortem.process.caps.boot[1].inheritable));
        } else
                chunk_appendf(&trash, "  capget() failed at boot with: %s.\n",
-                             strerror(post_mortem.process.caps.err_boot));
+                             errname(post_mortem.process.caps.err_boot, &err));
 
        /* let's print actual capabilities sets, could be useful in order to compare */
        if (!post_mortem.process.caps.err_run) {
@@ -632,7 +633,7 @@ static int debug_parse_cli_show_dev(char **args, char *payload, struct appctx *a
                                             post_mortem.process.caps.run[1].inheritable));
        } else
                chunk_appendf(&trash, "  capget() failed at runtime with: %s.\n",
-                             strerror(post_mortem.process.caps.err_run));
+                             errname(post_mortem.process.caps.err_run, &err));
 #endif
        chunk_appendf(&trash, "  boot limits:\n");
        chunk_appendf(&trash, "  \tfd limit (soft): %s\n",
@@ -654,6 +655,8 @@ static int debug_parse_cli_show_dev(char **args, char *payload, struct appctx *a
        chunk_appendf(&trash, "  \tram limit (hard): %s\n",
                      LIM2A(normalize_rlim(post_mortem.process.run_lim_ram.rlim_max), "unlimited"));
 
+       ha_free(&err);
+
        return cli_msg(appctx, LOG_INFO, trash.area);
 }