mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 10:35:20 +00:00
rotatingfile: mark log files as close-on-exec
The log file descriptor associated with the virRotatingFile struct should be marked close-on-exec, as even when virtlogd re-exec's itself it expect to open the log file fresh. It does not need to preserve the logfile handles, only the network client FDs. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
a8bb330f94
commit
bf02b123d1
@ -108,7 +108,7 @@ virRotatingFileWriterEntryNew(const char *path,
|
|||||||
if (VIR_ALLOC(entry) < 0)
|
if (VIR_ALLOC(entry) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if ((entry->fd = open(path, O_CREAT|O_APPEND|O_WRONLY, mode)) < 0) {
|
if ((entry->fd = open(path, O_CREAT|O_APPEND|O_WRONLY|O_CLOEXEC, mode)) < 0) {
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("Unable to open file: %s"), path);
|
_("Unable to open file: %s"), path);
|
||||||
goto error;
|
goto error;
|
||||||
@ -151,7 +151,7 @@ virRotatingFileReaderEntryNew(const char *path)
|
|||||||
if (VIR_ALLOC(entry) < 0)
|
if (VIR_ALLOC(entry) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if ((entry->fd = open(path, O_RDONLY)) < 0) {
|
if ((entry->fd = open(path, O_RDONLY|O_CLOEXEC)) < 0) {
|
||||||
if (errno != ENOENT) {
|
if (errno != ENOENT) {
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("Unable to open file: %s"), path);
|
_("Unable to open file: %s"), path);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user