diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2017-08-08 09:55:06 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2017-08-08 12:22:25 +0200 |
commit | 19a435a14baf33436af29f80775ab1950b8974aa (patch) | |
tree | f720b45ba5230957c23ceadafc5f0522ca075bf9 | |
parent | 83e7c1fa24aa6f9406d72dcc955e4c6992259360 (diff) |
device: avoid signals sent to the qmi-proxy processqmi-1-16
If e.g. qmi-proxy is started by ModemManager and we send a Ctrl+C to
it, the signal would be propagated to the qmi-proxy process and we
would kill it right away, while leaving ModemManager still around
wondering why the socket to the proxy got a HUP.
Avoid this, by making sure the qmi-proxy gets its own process group.
(cherry picked from commit 88ca109f9ca29fcff9651e2ac8930e6c3600ac64)
-rw-r--r-- | src/libqmi-glib/qmi-device.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libqmi-glib/qmi-device.c b/src/libqmi-glib/qmi-device.c index f815f11..20ac40e 100644 --- a/src/libqmi-glib/qmi-device.c +++ b/src/libqmi-glib/qmi-device.c @@ -1822,6 +1822,13 @@ wait_for_proxy_cb (CreateIostreamContext *ctx) } static void +spawn_child_setup (void) +{ + if (setpgid (0, 0) < 0) + g_warning ("couldn't setup proxy specific process group"); +} + +static void create_iostream_with_socket (CreateIostreamContext *ctx) { GSocketAddress *socket_address; @@ -1874,7 +1881,7 @@ create_iostream_with_socket (CreateIostreamContext *ctx) argc, NULL, /* envp */ G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL, - NULL, /* child_setup */ + (GSpawnChildSetupFunc) spawn_child_setup, NULL, /* child_setup_user_data */ NULL, &error)) { |