From 88ca109f9ca29fcff9651e2ac8930e6c3600ac64 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Tue, 8 Aug 2017 09:55:06 +0200 Subject: device: avoid signals sent to the qmi-proxy process 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. --- src/libqmi-glib/qmi-device.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libqmi-glib/qmi-device.c b/src/libqmi-glib/qmi-device.c index f35021e..841bcb4 100644 --- a/src/libqmi-glib/qmi-device.c +++ b/src/libqmi-glib/qmi-device.c @@ -1664,6 +1664,13 @@ wait_for_proxy_cb (GTask *task) } 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 (GTask *task) { QmiDevice *self; @@ -1721,7 +1728,7 @@ create_iostream_with_socket (GTask *task) 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)) { -- cgit v1.1