diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-09 09:42:44 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-09 09:42:44 +0100 |
commit | a59391482883479a9b28a6f1ace6d1ebd08a7ecd (patch) | |
tree | fa539db054a20a67bff2fc891c33b0f4ec632916 /Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp | |
parent | cfd86b747d32ac22246a1aa908eaa720c63a88c1 (diff) | |
download | qtwebkit-a59391482883479a9b28a6f1ace6d1ebd08a7ecd.tar.gz |
Imported WebKit commit 7bcdfab9a40db7d16b4b95bb77d78b8a59c9e701 (http://svn.webkit.org/repository/webkit/trunk@134025)
New snapshot with numerious build fixes, including MSVC 2012 and ARM Thumb-2.
Diffstat (limited to 'Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp')
-rw-r--r-- | Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp b/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp index 189e21379..d24c391cf 100644 --- a/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp +++ b/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp @@ -72,28 +72,34 @@ bool PluginProcessProxy::scanPlugin(const String& pluginPath, RawPluginMetaData& int status; char* stdOut = 0; + // If the disposition of SIGCLD signal is set to SIG_IGN (default) + // then the signal will be ignored and g_spawn_sync() will not be + // able to return the status. + // As a consequence, we make sure that the disposition is set to + // SIG_DFL before calling g_spawn_sync(). + struct sigaction action; + sigaction(SIGCLD, 0, &action); + if (action.sa_handler == SIG_IGN) { + action.sa_handler = SIG_DFL; + sigaction(SIGCLD, &action, 0); + } + if (!g_spawn_sync(0, argv, 0, G_SPAWN_STDERR_TO_DEV_NULL, 0, 0, &stdOut, 0, &status, 0)) return false; - if (!WIFEXITED(status) || WEXITSTATUS(status) != EXIT_SUCCESS) { + if (!WIFEXITED(status) || WEXITSTATUS(status) != EXIT_SUCCESS || !stdOut) { free(stdOut); return false; } - const unsigned kNumLinesExpected = 3; - String lines[kNumLinesExpected]; - unsigned lineIndex = 0; - - const UChar* current = reinterpret_cast<const UChar*>(stdOut); + String stdOutString(reinterpret_cast<const UChar*>(stdOut)); + free(stdOut); - while (lineIndex < kNumLinesExpected) { - const UChar* start = current; - while (*current++ != UChar('\n')) { } - lines[lineIndex++] = String(start, current - start - 1); - } + Vector<String> lines; + stdOutString.split(UChar('\n'), lines); - if (stdOut) - free(stdOut); + if (lines.size() < 3) + return false; result.name.swap(lines[0]); result.description.swap(lines[1]); |