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:24:03 +0200
commitb84411d522828c90c2e4228a3a61e3e1c88fd939 (patch)
tree0560ef5b0522850c956c416d517419f89c658928
parente51f3d21590c0b9a10217813eaa82efe033470f4 (diff)
device: avoid signals sent to the qmi-proxy processqmi-1-12
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 c0b494b..fcde914 100644
--- a/src/libqmi-glib/qmi-device.c
+++ b/src/libqmi-glib/qmi-device.c
@@ -1510,6 +1510,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;
@@ -1562,7 +1569,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)) {