From 8ec4cf751d3cbd48d18036e279fe25226ea663f8 Mon Sep 17 00:00:00 2001 From: Michael Ortmann Date: Mon, 2 Oct 2023 20:09:43 +0200 Subject: [PATCH] rename tell_verbose_status() into tell_status that takes an additional parameter to distinguish between status and status all that has more detail and use it to tell maximum number of open files (sockets) only if detail requested --- src/chanprog.c | 4 ++-- src/cmds.c | 4 ++-- src/main.c | 2 +- src/proto.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/chanprog.c b/src/chanprog.c index d98a76a50..8dfb06396 100644 --- a/src/chanprog.c +++ b/src/chanprog.c @@ -269,7 +269,7 @@ void tell_verbose_uptime(int idx) /* Dump status info out to dcc */ -void tell_verbose_status(int idx) +void tell_status(int idx, int details) { char s[256], s1[121], s2[81], *sysrel; int i; @@ -368,7 +368,7 @@ void tell_verbose_status(int idx) #endif "Socket table: %d/%d\n", threaddata()->MAXSOCKS, max_socks); - if (!getrlimit(RLIMIT_NOFILE, &rlp)) + if (details && !getrlimit(RLIMIT_NOFILE, &rlp)) dprintf(idx, "Maximum number of open files (sockets): soft limit %ju hard limit %ju\n", (uintmax_t) rlp.rlim_cur, (uintmax_t) rlp.rlim_max); } diff --git a/src/cmds.c b/src/cmds.c index 5e2b04407..e0e3963c0 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -590,14 +590,14 @@ static void cmd_status(struct userrec *u, int idx, char *par) return; } putlog(LOG_CMDS, "*", "#%s# status all", dcc[idx].nick); - tell_verbose_status(idx); + tell_status(idx, 1); tell_mem_status_dcc(idx); dprintf(idx, "\n"); tell_settings(idx); do_module_report(idx, 1, NULL); } else { putlog(LOG_CMDS, "*", "#%s# status", dcc[idx].nick); - tell_verbose_status(idx); + tell_status(idx, 0); tell_mem_status_dcc(idx); do_module_report(idx, 0, NULL); } diff --git a/src/main.c b/src/main.c index d4bee020c..c6eb200bf 100644 --- a/src/main.c +++ b/src/main.c @@ -632,7 +632,7 @@ static void core_secondly() printf("NOTE: You don't need to use the -n flag with the\n"); printf(" -t or -c flag anymore.\n"); } - tell_verbose_status(DP_STDOUT); + tell_status(DP_STDOUT, 1); do_module_report(DP_STDOUT, 0, "server"); do_module_report(DP_STDOUT, 0, "channels"); tell_mem_status_dcc(DP_STDOUT); diff --git a/src/proto.h b/src/proto.h index 054fe204d..67562595d 100644 --- a/src/proto.h +++ b/src/proto.h @@ -99,7 +99,7 @@ char *int_to_base64(unsigned int); /* chanprog.c */ void tell_verbose_uptime(int); -void tell_verbose_status(int); +void tell_status(int, int); void tell_settings(int); int logmodes(char *); int isowner(char *);