summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2017-08-08 09:55:06 +0200
committerAleksander Morgado <aleksander@aleksander.es>2017-08-08 12:23:30 +0200
commitec3a14d58426190b1d6b76447532459c19fb4d99 (patch)
treef866d086a91a2abc0e5e94f4a02bee761235a35b
parenta182232458eb5365bc6cca045fbc0d6af812b6e9 (diff)
device: avoid signals sent to the qmi-proxy processqmi-1-14
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.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libqmi-glib/qmi-device.c b/src/libqmi-glib/qmi-device.c
index ac81745..46f1838 100644
--- a/src/libqmi-glib/qmi-device.c
+++ b/src/libqmi-glib/qmi-device.c
@@ -1810,6 +1810,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;
@@ -1862,7 +1869,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)) {