From: Jihye Won Date: Tue, 13 Oct 2015 05:02:10 +0000 (+0900) Subject: qt5_msgbox: check if message has only a newline character. X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~229 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a12e18a34b0cbecdf2fb41642090dc429523840a;p=sdk%2Femulator%2Fqemu.git qt5_msgbox: check if message has only a newline character. qt5_msgbox shows an empty message when the message as the argument of error_report() ends a newline character. So, it is necessary to check if the message is valid before executing qt5_msgbox. Change-Id: I48e4bd0e484a69bd00c6a9aace5b4390d996bd62 Signed-off-by: Jihye Won --- diff --git a/tizen/src/util/qt5_error_report.c b/tizen/src/util/qt5_error_report.c index d9f3c868c1..dacc5a1614 100644 --- a/tizen/src/util/qt5_error_report.c +++ b/tizen/src/util/qt5_error_report.c @@ -40,6 +40,8 @@ #include #endif +#define MAX_MESSAGE_LEN 2048 + MULTI_DEBUG_CHANNEL(qemu, qt5_msgbox); static const char * const icon_types[] = { @@ -63,23 +65,36 @@ char *get_app_path(void) void start_qt5_msgbox(qt5_msgbox_icon icon, const char *message) { + INFO("qt5_msgbox starts... \n"); + + if (message[0] == '\n' && strnlen(message, MAX_MESSAGE_LEN) == 1) { + ERR("The message has only a new-line character. \n" ); + return; + } + char *app_path = get_app_path(); const char *title = "Emulator"; const char *argv[] = {app_path, icon_types[icon], title, message, NULL}; #ifdef CONFIG_WIN32 - INFO("qt5_msgbox starts... \n"); - if (_spawnv(P_NOWAIT, app_path, (const char * const *) argv) == -1) - ERR("qt5_msgbox can not be executed \n"); + if (_spawnv(P_NOWAIT, app_path, (const char * const *) argv) == -1) { + ERR("qt5_msgbox can not be executed. \n"); + g_free(app_path); + return; + } #else pid_t child_pid = fork(); if (child_pid == 0) { - INFO("qt5_msgbox starts... \n"); - if(execvp(app_path, (char * const *) argv) == -1) - ERR("qt5_msgbox can not be executed \n"); + if (execvp(app_path, (char * const *) argv) == -1) { + ERR("qt5_msgbox can not be executed. \n"); + g_free(app_path); + return; + } exit(0); } else if (child_pid == -1) { - ERR("qt5_msgbox can not be executed \n"); + ERR("child process for qt5_msgbox can not be created. \n"); + g_free(app_path); + return; } #endif g_free(app_path);