Handle failure to open log file

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@258 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
Benny Prijono 2006-03-01 22:26:38 +00:00
parent bb1e6e3034
commit 858b2fe92b
1 changed files with 12 additions and 3 deletions

View File

@ -846,7 +846,7 @@ static void app_log_writer(int level, const char *buffer, int len)
}
void app_logging_init(void)
pj_status_t app_logging_init(void)
{
/* Redirect log function to ours */
@ -854,8 +854,16 @@ void app_logging_init(void)
/* If output log file is desired, create the file: */
if (pjsua.log_filename)
if (pjsua.log_filename) {
log_file = fopen(pjsua.log_filename, "wt");
if (log_file == NULL) {
PJ_LOG(1,(THIS_FILE, "Unable to open log file %s",
pjsua.log_filename));
return -1;
}
}
return PJ_SUCCESS;
}
@ -911,7 +919,8 @@ int main(int argc, char *argv[])
/* Init logging: */
app_logging_init();
if (app_logging_init() != PJ_SUCCESS)
return 1;
/* Register message logger to print incoming and outgoing