[NetworkManager-openconnect] Prevent noise to stdout
- From: David Woodhouse <dwmw2 src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [NetworkManager-openconnect] Prevent noise to stdout
- Date: Thu, 28 Apr 2022 14:14:51 +0000 (UTC)
commit 521b77ff503f4670ccd0b1297cd3b554b659d77f
Author: David Woodhouse <dwmw2 infradead org>
Date: Thu Apr 28 15:14:31 2022 +0100
Prevent noise to stdout
Sometimes, a spawned browser may spam stdout. We don't want that.
auth-dialog/main.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index 650cd2d..99cab7c 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -1964,6 +1964,12 @@ int main (int argc, char **argv)
GThread *init_thread;
gchar *key, *value;
int opt;
+ int param_fd = dup(1);
+ FILE *paramf = fdopen(param_fd, "w");
+
+ /* We don't want stdout from child processes / logging to confuse NM
+ * so redirect it to stderr instead. */
+ dup2(2, 1);
while ((opt = getopt_long(argc, argv, "ru:n:s:i", long_options, NULL))) {
if (opt < 0)
@@ -2050,9 +2056,9 @@ int main (int argc, char **argv)
if (g_hash_table_size (_ui_data->secrets) > 0) {
g_hash_table_iter_init (&iter, _ui_data->secrets);
while (g_hash_table_iter_next (&iter, (gpointer *)&key, (gpointer *)&value))
- printf("%s\n%s\n", key, value);
- printf("\n\n");
- fflush(stdout);
+ fprintf(paramf, "%s\n%s\n", key, value);
+ fprintf(paramf, "\n\n");
+ fflush(paramf);
}
wait_for_quit ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]