mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
lib: Simplify check_log_size
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
bf1ad5051f
commit
8aa67651db
@ -708,18 +708,16 @@ void check_log_size( void )
|
||||
(void)reopen_logs_internal();
|
||||
if (state.fd > 2 && (fstat(state.fd, &st) == 0
|
||||
&& st.st_size > maxlog)) {
|
||||
char *name = NULL;
|
||||
char name[strlen(state.debugf) + 5];
|
||||
|
||||
snprintf(name, sizeof(name), "%s.old", state.debugf);
|
||||
|
||||
if (asprintf(&name, "%s.old", state.debugf ) < 0) {
|
||||
return;
|
||||
}
|
||||
(void)rename(state.debugf, name);
|
||||
|
||||
if (!reopen_logs_internal()) {
|
||||
/* We failed to reopen a log - continue using the old name. */
|
||||
(void)rename(name, state.debugf);
|
||||
}
|
||||
SAFE_FREE(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user