Title: [141319] trunk/Source/WebKit2
Revision
141319
Author
[email protected]
Date
2013-01-30 14:44:52 -0800 (Wed, 30 Jan 2013)

Log Message

[WK2][UNIX] g_spawn_sync() generates warning in PluginProcessProxy::scanPlugin()
https://bugs.webkit.org/show_bug.cgi?id=108371

Patch by Christophe Dumez <[email protected]> on 2013-01-30
Reviewed by Martin Robinson.

g_spawn_sync() was sometimes displaying a warning about the SIGCHLD
signal disposition not being set to SIG_DFL, despite the fix in r133755.
The reason was that the code was only setting the disposition to SIG_DFL
if the previous disposition was SIG_IGN.

In this patch, we set the SIGCHLD signal disposition to SIG_DFL, no
matter what its previous disposition was. Also, the signal disposition
is now restored to its previous state after the call to g_spawn_sync()
to avoid side effects. Finally, we now use SIGCHLD instead of SIDCLD
since this is the more compatible POSIX name.

* UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
(WebKit::spawnProcessSync):
(WebKit):
(WebKit::PluginProcessProxy::scanPlugin):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (141318 => 141319)


--- trunk/Source/WebKit2/ChangeLog	2013-01-30 22:43:57 UTC (rev 141318)
+++ trunk/Source/WebKit2/ChangeLog	2013-01-30 22:44:52 UTC (rev 141319)
@@ -1,3 +1,26 @@
+2013-01-30  Christophe Dumez  <[email protected]>
+
+        [WK2][UNIX] g_spawn_sync() generates warning in PluginProcessProxy::scanPlugin()
+        https://bugs.webkit.org/show_bug.cgi?id=108371
+
+        Reviewed by Martin Robinson.
+
+        g_spawn_sync() was sometimes displaying a warning about the SIGCHLD
+        signal disposition not being set to SIG_DFL, despite the fix in r133755.
+        The reason was that the code was only setting the disposition to SIG_DFL
+        if the previous disposition was SIG_IGN.
+
+        In this patch, we set the SIGCHLD signal disposition to SIG_DFL, no
+        matter what its previous disposition was. Also, the signal disposition
+        is now restored to its previous state after the call to g_spawn_sync()
+        to avoid side effects. Finally, we now use SIGCHLD instead of SIDCLD
+        since this is the more compatible POSIX name.
+
+        * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
+        (WebKit::spawnProcessSync):
+        (WebKit):
+        (WebKit::PluginProcessProxy::scanPlugin):
+
 2013-01-30  Huang Dongsung  <[email protected]>
 
         [EFL][Qt][WK2] We should consider a page scale factor in WebCore instead of our own scale factor.

Modified: trunk/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp (141318 => 141319)


--- trunk/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp	2013-01-30 22:43:57 UTC (rev 141318)
+++ trunk/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp	2013-01-30 22:44:52 UTC (rev 141319)
@@ -58,6 +58,26 @@
 {
 }
 
+static bool spawnProcessSync(char** argv, char** standardOutput, char** standardError, int* exitStatus)
+{
+    // If the disposition of SIGCHLD 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 defaultAction, oldAction;
+    defaultAction.sa_handler = SIG_DFL;
+    defaultAction.sa_flags = 0;
+    sigemptyset(&defaultAction.sa_mask);
+    sigaction(SIGCHLD, &defaultAction, &oldAction);
+
+    bool success = g_spawn_sync(0, argv, 0, G_SPAWN_STDERR_TO_DEV_NULL, 0, 0, standardOutput, standardError, exitStatus, 0);
+
+    // Restore SIGCHLD signal disposition.
+    sigaction(SIGCHLD, &oldAction, 0);
+
+    return success;
+}
+
 bool PluginProcessProxy::scanPlugin(const String& pluginPath, RawPluginMetaData& result)
 {
 #if PLATFORM(GTK) || PLATFORM(EFL)
@@ -72,19 +92,8 @@
     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))
+    if (!spawnProcessSync(argv, &stdOut, 0, &status))
         return false;
 
     if (!WIFEXITED(status) || WEXITSTATUS(status) != EXIT_SUCCESS || !stdOut) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to