]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
radmin: The 'stats memory <option>' needs the server started with '-M'
authorJorge Pereira <jpereira@freeradius.org>
Fri, 30 Aug 2019 20:15:28 +0000 (17:15 -0300)
committerAlan DeKok <aland@freeradius.org>
Fri, 30 Aug 2019 20:22:40 +0000 (16:22 -0400)
therefore, let the use aware of it instead of see '0' values.

src/bin/radmin.c

index 2dea98b891443dae5fb9f2073b411fcaee01c961..f26ad0b974b3a60ce149caef3ac79d7569fbeb5b 100644 (file)
@@ -463,6 +463,11 @@ static int cmd_uptime(FILE *fp, UNUSED FILE *fp_err, UNUSED void *ctx, UNUSED fr
 
 static int cmd_stats_memory(FILE *fp, FILE *fp_err, UNUSED void *ctx, fr_cmd_info_t const *info)
 {
+       if (!radmin_main_config->talloc_memory_report) {
+               fprintf(fp, "Statistics are only available when the server is started with '-M'.\n");
+               return -1;
+       }
+
        if (strcmp(info->argv[0], "total") == 0) {
                fprintf(fp, "%zd\n", talloc_total_size(NULL));
                return 0;
@@ -506,7 +511,6 @@ static int cmd_show_debug_level(FILE *fp, UNUSED FILE *fp_err, UNUSED void *ctx,
        return 0;
 }
 
-
 static int tab_expand_config_thing(TALLOC_CTX *talloc_ctx, UNUSED void *ctx, fr_cmd_info_t *info, int max_expansions, char const **expansions,
                                   bool want_section)
 {