summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2015-02-16 15:59:11 +1300
committerKarolin Seeger <kseeger@samba.org>2015-02-25 20:05:09 +0100
commit630db2f10c3f97620de821f2c55805d34cef7c1f (patch)
tree44a9133e546afefc0c07449a4cb487c643122125 /lib
parentdd89495cc926aa9c8d5fd33d89bdd5e4a6d907e1 (diff)
downloadsamba-630db2f10c3f97620de821f2c55805d34cef7c1f.tar.gz
debug: Set close-on-exec for the main log file FD
This does not change the properties of dup2() of the fd as STDERR, however this is closed before we start smbd or winbindd as child processes. This is needed otherwise the logfile remains open in the child process, and logfile rotation can mean this old log remains on disk indefinatly. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11100 Pair-programmed-with: Garming Sam <garming@catalyst.net.nz> Signed-off-by: Garming Sam <garming@catalyst.net.nz> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Mon Feb 16 11:42:47 CET 2015 on sn-devel-104 (based on commit 1d95b0afc3547a91f8558873ce58652c271ed9eb)
Diffstat (limited to 'lib')
-rw-r--r--lib/util/debug.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/util/debug.c b/lib/util/debug.c
index a46b2753cfc..cf42d366b29 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -596,6 +596,7 @@ bool reopen_logs_internal(void)
log_overflow = false;
ret = false;
} else {
+ smb_set_close_on_exec(new_fd);
old_fd = state.fd;
state.fd = new_fd;
debug_close_fd(old_fd);
@@ -729,6 +730,7 @@ void check_log_size( void )
*/
int fd = open( "/dev/console", O_WRONLY, 0);
if (fd != -1) {
+ smb_set_close_on_exec(fd);
state.fd = fd;
DEBUG(0,("check_log_size: open of debug file %s failed - using console.\n",
state.debugf ));
@@ -791,6 +793,7 @@ void check_log_size( void )
errno = old_errno;
goto done;
}
+ smb_set_close_on_exec(fd);
state.fd = fd;
}
}