From 10ea8f0cfcb9ae96d1ca29787d1863609f29afb0 Mon Sep 17 00:00:00 2001 From: Andrew Niefer Date: Fri, 18 Apr 2008 18:59:57 +0000 Subject: bug 209080 - don't print exit msg on empty exitdata --- bundles/org.eclipse.equinox.executable/library/eclipse.c | 16 ++++++++-------- .../org.eclipse.equinox.executable/library/eclipseJNI.c | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'bundles') diff --git a/bundles/org.eclipse.equinox.executable/library/eclipse.c b/bundles/org.eclipse.equinox.executable/library/eclipse.c index b2d9ba16b..4fee3877f 100644 --- a/bundles/org.eclipse.equinox.executable/library/eclipse.c +++ b/bundles/org.eclipse.equinox.executable/library/eclipse.c @@ -523,10 +523,7 @@ JNIEXPORT int run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[]) if (exitData != 0) { errorMsg = exitData; exitData = NULL; - if (_tcslen( errorMsg ) == 0) { - free( errorMsg ); - errorMsg = NULL; - } else { + if (_tcslen( errorMsg ) > 0) { _TCHAR *str; if (_tcsncmp(errorMsg, _T_ECLIPSE(""), _tcslen(_T_ECLIPSE("<title>"))) == 0) { str = _tcsstr(errorMsg, _T_ECLIPSE("")); @@ -552,10 +549,13 @@ JNIEXPORT int run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[]) errorMsg = malloc( (_tcslen(exitMsg) + _tcslen(msg) + 10) * sizeof(_TCHAR) ); _stprintf( errorMsg, exitMsg, exitCode, msg ); } - if (!suppressErrors) - displayMessage( title, errorMsg ); - else - _ftprintf(stderr, _T_ECLIPSE("%s:\n%s\n"), title, errorMsg); + + if (_tcslen(errorMsg) > 0) { + if (!suppressErrors) + displayMessage( title, errorMsg ); + else + _ftprintf(stderr, _T_ECLIPSE("%s:\n%s\n"), title, errorMsg); + } free( errorMsg ); free( title ); break; diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseJNI.c b/bundles/org.eclipse.equinox.executable/library/eclipseJNI.c index 994cd362e..f0e32f1bd 100644 --- a/bundles/org.eclipse.equinox.executable/library/eclipseJNI.c +++ b/bundles/org.eclipse.equinox.executable/library/eclipseJNI.c @@ -157,7 +157,7 @@ void setExitData(JNIEnv *env, jstring id, jstring s){ } else { exitData = malloc((length + 1) * sizeof(_TCHAR*)); _tcsncpy( exitData, data, length); - exitData[length] = 0; + exitData[length] = _T_ECLIPSE('\0'); } JNI_ReleaseStringChars(env, s, data); } -- cgit v1.2.3