mirror of
https://git.proxmox.com/git/mirror_corosync
synced 2025-07-26 22:18:03 +00:00
don't keep logsys fd open unless it's required
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1739 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
parent
9b5f09c729
commit
d7024f53d6
@ -833,11 +833,20 @@ unsigned int logsys_config_mode_get (void)
|
||||
return logsys_mode;
|
||||
}
|
||||
|
||||
static void logsys_close_logfile()
|
||||
{
|
||||
if (logsys_file_fp != NULL) {
|
||||
fclose (logsys_file_fp);
|
||||
logsys_file_fp = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int logsys_config_file_set (char **error_string, char *file)
|
||||
{
|
||||
static char error_string_response[512];
|
||||
|
||||
if (file == NULL) {
|
||||
logsys_close_logfile();
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -845,9 +854,7 @@ int logsys_config_file_set (char **error_string, char *file)
|
||||
|
||||
if (logsys_mode & LOG_MODE_OUTPUT_FILE) {
|
||||
logsys_file = file;
|
||||
if (logsys_file_fp != NULL) {
|
||||
fclose (logsys_file_fp);
|
||||
}
|
||||
logsys_close_logfile();
|
||||
logsys_file_fp = fopen (file, "a+");
|
||||
if (logsys_file_fp == 0) {
|
||||
sprintf (error_string_response,
|
||||
@ -857,7 +864,8 @@ int logsys_config_file_set (char **error_string, char *file)
|
||||
pthread_mutex_unlock (&logsys_config_mutex);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
} else
|
||||
logsys_close_logfile();
|
||||
|
||||
pthread_mutex_unlock (&logsys_config_mutex);
|
||||
return (0);
|
||||
|
Loading…
Reference in New Issue
Block a user