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 12:15:29 +0200
commit52af45d22c681bc8479de278b597e675f44bd42b (patch)
tree324cbd72f34ab93c0988128254eb19ceadef1025
parentaf0bbe852925a2981693684a385fab098b983539 (diff)
device: avoid signals sent to the mbim-proxy processmbim-1-10
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. (cherry picked from commit 5bb673fe87ff9462bdec6435487d57982f886968)
-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 300d3ec..750b606 100644
--- a/src/libmbim-glib/mbim-device.c
+++ b/src/libmbim-glib/mbim-device.c
@@ -940,6 +940,13 @@ wait_for_proxy_cb (CreateIoChannelContext *ctx)
}
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 (CreateIoChannelContext *ctx)
{
GSocketAddress *socket_address;
@@ -996,7 +1003,7 @@ create_iochannel_with_socket (CreateIoChannelContext *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)) {