|
|
@ -22,15 +22,6 @@ static const char *verbosity_colors[] = {
|
|
|
|
|
|
|
|
|
|
|
|
void init_log(log_importance_t verbosity) {
|
|
|
|
void init_log(log_importance_t verbosity) {
|
|
|
|
v = verbosity;
|
|
|
|
v = verbosity;
|
|
|
|
/* set FD_CLOEXEC flag to prevent programs called with exec to write into logs */
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
int fd[] = { STDOUT_FILENO, STDIN_FILENO, STDERR_FILENO };
|
|
|
|
|
|
|
|
for (i = 0; i < 3; ++i) {
|
|
|
|
|
|
|
|
int flag = fcntl(fd[i], F_GETFD);
|
|
|
|
|
|
|
|
if (flag != -1) {
|
|
|
|
|
|
|
|
fcntl(fd[i], F_SETFD, flag | FD_CLOEXEC);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
signal(SIGSEGV, error_handler);
|
|
|
|
signal(SIGSEGV, error_handler);
|
|
|
|
signal(SIGABRT, error_handler);
|
|
|
|
signal(SIGABRT, error_handler);
|
|
|
|
}
|
|
|
|
}
|
|
|
|