From 68af0002af7d7afe2128a94a59c19ffd63c7173f Mon Sep 17 00:00:00 2001 From: Nanang Izzuddin Date: Fri, 23 May 2014 09:29:09 +0000 Subject: Misc (re #1751): Fixed uninitialized config filename in ui_write_settings() in pjsua app (thanks Lars Helgeson for the report). git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4851 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip-apps/src/pjsua/pjsua_app_legacy.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pjsip-apps/src/pjsua/pjsua_app_legacy.c b/pjsip-apps/src/pjsua/pjsua_app_legacy.c index 0e9333ef..ed960e30 100644 --- a/pjsip-apps/src/pjsua/pjsua_app_legacy.c +++ b/pjsip-apps/src/pjsua/pjsua_app_legacy.c @@ -1613,11 +1613,10 @@ static void ui_dump_configuration() len, settings)); } -static void ui_write_settings() +static void ui_write_settings(const char *filename) { char settings[2000]; int len; - char buf[128]; len = write_settings(&app_config, settings, sizeof(settings)); if (len < 1) @@ -1626,7 +1625,7 @@ static void ui_write_settings() pj_oshandle_t fd; pj_status_t status; - status = pj_file_open(app_config.pool, buf, PJ_O_WRONLY, &fd); + status = pj_file_open(app_config.pool, filename, PJ_O_WRONLY, &fd); if (status != PJ_SUCCESS) { pjsua_perror(THIS_FILE, "Unable to open file", status); } else { @@ -1634,7 +1633,7 @@ static void ui_write_settings() pj_file_write(fd, settings, &size); pj_file_close(fd); - printf("Settings successfully written to '%s'\n", buf); + printf("Settings successfully written to '%s'\n", filename); } } } @@ -1907,7 +1906,7 @@ void legacy_main() case 'f': if (simple_input("Enter output filename", buf, sizeof(buf))) { - ui_write_settings(); + ui_write_settings(buf); } break; -- cgit v1.2.3