summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-03-01 22:26:38 +0000
committerBenny Prijono <bennylp@teluu.com>2006-03-01 22:26:38 +0000
commit486fe5f8d2bfdc2a646ce65e47e2b632e6b0de1e (patch)
tree62a29834a4b1bdbe17b0370156014a02d8c09f78
parent452a886ba30887b104c051fdc5003fd12d3aecde (diff)
Handle failure to open log file
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@258 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip-apps/src/pjsua/main.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/pjsip-apps/src/pjsua/main.c b/pjsip-apps/src/pjsua/main.c
index d8539a7a..7f99954a 100644
--- a/pjsip-apps/src/pjsua/main.c
+++ b/pjsip-apps/src/pjsua/main.c
@@ -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