summaryrefslogtreecommitdiff
path: root/lib/util
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2020-11-23 15:51:09 +0100
committerJeremy Allison <jra@samba.org>2020-12-07 17:54:10 +0000
commitb7ee36146458bcc2c944f5670b7632df8281ae61 (patch)
tree7c4a20482b9d731ef3ed8390e26dc07960c1464c /lib/util
parent29cd139a32d5dbf36bef68eb9c7f1160201e3042 (diff)
downloadsamba-b7ee36146458bcc2c944f5670b7632df8281ae61.tar.gz
debug: pass struct debug_class *config to do_one_check_log_size()
Pass a pointer to the struct instead of all struct members individually. No change in behaviour. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14248 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib/util')
-rw-r--r--lib/util/debug.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/lib/util/debug.c b/lib/util/debug.c
index fa98b82e644..5761985156e 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -1249,11 +1249,10 @@ bool need_to_check_log_size(void)
Check to see if the log has grown to be too big.
**************************************************************************/
-static void do_one_check_log_size(off_t maxlog, int *_fd, const char *logfile)
+static void do_one_check_log_size(off_t maxlog, struct debug_class *config)
{
- char name[strlen(logfile) + 5];
+ char name[strlen(config->logfile) + 5];
struct stat st;
- int fd = *_fd;
int ret;
bool ok;
@@ -1261,7 +1260,7 @@ static void do_one_check_log_size(off_t maxlog, int *_fd, const char *logfile)
return;
}
- ret = fstat(fd, &st);
+ ret = fstat(config->fd, &st);
if (ret != 0) {
return;
}
@@ -1271,12 +1270,11 @@ static void do_one_check_log_size(off_t maxlog, int *_fd, const char *logfile)
/* reopen_logs_internal() modifies *_fd */
(void)reopen_logs_internal();
- fd = *_fd;
- if (fd <= 2) {
+ if (config->fd <= 2) {
return;
}
- ret = fstat(fd, &st);
+ ret = fstat(config->fd, &st);
if (ret != 0) {
return;
}
@@ -1284,16 +1282,16 @@ static void do_one_check_log_size(off_t maxlog, int *_fd, const char *logfile)
return;
}
- snprintf(name, sizeof(name), "%s.old", logfile);
+ snprintf(name, sizeof(name), "%s.old", config->logfile);
- (void)rename(logfile, name);
+ (void)rename(config->logfile, name);
ok = reopen_logs_internal();
if (ok) {
return;
}
/* We failed to reopen a log - continue using the old name. */
- (void)rename(name, logfile);
+ (void)rename(name, config->logfile);
}
static void do_check_log_size(off_t maxlog)
@@ -1307,9 +1305,7 @@ static void do_check_log_size(off_t maxlog)
if (dbgc_config[i].logfile == NULL) {
continue;
}
- do_one_check_log_size(maxlog,
- &dbgc_config[i].fd,
- dbgc_config[i].logfile);
+ do_one_check_log_size(maxlog, &dbgc_config[i]);
}
}