1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

B #4359: Fix scheduler logging std (#1195)

This commit is contained in:
Pavel Czerný 2021-05-10 09:43:00 +02:00 committed by Ruben S. Montero
parent 80a64e9791
commit 92073f9269
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87

View File

@ -334,20 +334,26 @@ void Scheduler::start()
// -----------------------------------------------------------
// Close stds, we no longer need them
// -----------------------------------------------------------
if (NebulaLog::log_type() != NebulaLog::STD )
{
int fd = open("/dev/null", O_RDWR);
int fd;
dup2(fd,0);
dup2(fd,1);
dup2(fd,2);
fd = open("/dev/null", O_RDWR);
close(fd);
dup2(fd,0);
dup2(fd,1);
dup2(fd,2);
close(fd);
fcntl(0,F_SETFD,0); // Keep them open across exec funcs
fcntl(1,F_SETFD,0);
fcntl(2,F_SETFD,0);
fcntl(0, F_SETFD, 0); // Keep them open across exec funcs
fcntl(1, F_SETFD, 0);
fcntl(2, F_SETFD, 0);
}
else
{
fcntl(0, F_SETFD, FD_CLOEXEC);
fcntl(1, F_SETFD, FD_CLOEXEC);
fcntl(2, F_SETFD, FD_CLOEXEC);
}
// -----------------------------------------------------------
// Block all signals before creating any thread