diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2017-08-08 09:55:06 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2017-08-08 09:55:06 +0200 |
commit | 88ca109f9ca29fcff9651e2ac8930e6c3600ac64 (patch) | |
tree | 6e86c864d5cb5dd9503b08423a8c8a00cd50b683 | |
parent | 0e7236575bb776cf061de615d51180c88d1c5c2b (diff) | |
download | external_libqmi-88ca109f9ca29fcff9651e2ac8930e6c3600ac64.zip external_libqmi-88ca109f9ca29fcff9651e2ac8930e6c3600ac64.tar.gz external_libqmi-88ca109f9ca29fcff9651e2ac8930e6c3600ac64.tar.bz2 |
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.
-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 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)) { |