summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2017-08-06 13:13:40 +0200
committerAleksander Morgado <aleksander@aleksander.es>2017-08-08 09:51:15 +0200
commit5bb673fe87ff9462bdec6435487d57982f886968 (patch)
tree23502802cfe8cf6f745b5431aec8acdcdb43dca4
parentcd65ee939cbc95de7ee50e1fd3756c35fddaa41f (diff)
device: avoid signals sent to the mbim-proxy process
If e.g. mbim-proxy is started by ModemManager and we send a Ctrl+C to it, the signal would be propagated to the mbim-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 mbim-proxy gets its own process group.
-rw-r--r--src/libmbim-glib/mbim-device.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libmbim-glib/mbim-device.c b/src/libmbim-glib/mbim-device.c
index 68544af..4b7d431 100644
--- a/src/libmbim-glib/mbim-device.c
+++ b/src/libmbim-glib/mbim-device.c
@@ -1077,6 +1077,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_iochannel_with_socket (GTask *task)
{
MbimDevice *self;
@@ -1138,7 +1145,7 @@ create_iochannel_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)) {