Changeset 141319 in webkit


Ignore:
Timestamp:
Jan 30, 2013 2:44:52 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Christophe Dumez <dchris@gmail.com> 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):

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r141310 r141319  
     12013-01-30  Christophe Dumez  <dchris@gmail.com>
     2
     3        [WK2][UNIX] g_spawn_sync() generates warning in PluginProcessProxy::scanPlugin()
     4        https://bugs.webkit.org/show_bug.cgi?id=108371
     5
     6        Reviewed by Martin Robinson.
     7
     8        g_spawn_sync() was sometimes displaying a warning about the SIGCHLD
     9        signal disposition not being set to SIG_DFL, despite the fix in r133755.
     10        The reason was that the code was only setting the disposition to SIG_DFL
     11        if the previous disposition was SIG_IGN.
     12
     13        In this patch, we set the SIGCHLD signal disposition to SIG_DFL, no
     14        matter what its previous disposition was. Also, the signal disposition
     15        is now restored to its previous state after the call to g_spawn_sync()
     16        to avoid side effects. Finally, we now use SIGCHLD instead of SIDCLD
     17        since this is the more compatible POSIX name.
     18
     19        * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
     20        (WebKit::spawnProcessSync):
     21        (WebKit):
     22        (WebKit::PluginProcessProxy::scanPlugin):
     23
    1242013-01-30  Huang Dongsung  <luxtella@company100.net>
    225
  • trunk/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp

    r141275 r141319  
    5959}
    6060
     61static bool spawnProcessSync(char** argv, char** standardOutput, char** standardError, int* exitStatus)
     62{
     63    // If the disposition of SIGCHLD signal is set to SIG_IGN (default) then
     64    // the signal will be ignored and g_spawn_sync() will not be able to return
     65    // the status. As a consequence, we make sure that the disposition is set
     66    // to SIG_DFL before calling g_spawn_sync().
     67    struct sigaction defaultAction, oldAction;
     68    defaultAction.sa_handler = SIG_DFL;
     69    defaultAction.sa_flags = 0;
     70    sigemptyset(&defaultAction.sa_mask);
     71    sigaction(SIGCHLD, &defaultAction, &oldAction);
     72
     73    bool success = g_spawn_sync(0, argv, 0, G_SPAWN_STDERR_TO_DEV_NULL, 0, 0, standardOutput, standardError, exitStatus, 0);
     74
     75    // Restore SIGCHLD signal disposition.
     76    sigaction(SIGCHLD, &oldAction, 0);
     77
     78    return success;
     79}
     80
    6181bool PluginProcessProxy::scanPlugin(const String& pluginPath, RawPluginMetaData& result)
    6282{
     
    7393    char* stdOut = 0;
    7494
    75     // If the disposition of SIGCLD signal is set to SIG_IGN (default)
    76     // then the signal will be ignored and g_spawn_sync() will not be
    77     // able to return the status.
    78     // As a consequence, we make sure that the disposition is set to
    79     // SIG_DFL before calling g_spawn_sync().
    80     struct sigaction action;
    81     sigaction(SIGCLD, 0, &action);
    82     if (action.sa_handler == SIG_IGN) {
    83         action.sa_handler = SIG_DFL;
    84         sigaction(SIGCLD, &action, 0);
    85     }
    8695
    87     if (!g_spawn_sync(0, argv, 0, G_SPAWN_STDERR_TO_DEV_NULL, 0, 0, &stdOut, 0, &status, 0))
     96    if (!spawnProcessSync(argv, &stdOut, 0, &status))
    8897        return false;
    8998
Note: See TracChangeset for help on using the changeset viewer.