From cd3dc1ccbd16a28e7545a032808786a7638cde67 Mon Sep 17 00:00:00 2001 From: Manish Singh Date: Thu, 3 Jun 1999 23:35:10 +0000 Subject: [PATCH] check isatty() before querying so we don't loop endlessly * gerror.c (g_on_error_query): check isatty() before querying so we don't loop endlessly -Yosh --- ChangeLog | 5 +++++ ChangeLog.pre-2-0 | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-12 | 5 +++++ ChangeLog.pre-2-2 | 5 +++++ ChangeLog.pre-2-4 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ gbacktrace.c | 9 ++++++++- gerror.c | 9 ++++++++- glib/gbacktrace.c | 9 ++++++++- glib/gerror.c | 9 ++++++++- 12 files changed, 72 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8ea497d2c..448f9efcb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Jun 3 16:30:31 PDT 1999 Manish Singh + + * gerror.c (g_on_error_query): check isatty() before querying so + we don't loop endlessly + Sat May 29 11:16:29 PDT 1999 Manish Singh * acinclude.m4 diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 8ea497d2c..448f9efcb 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,8 @@ +Thu Jun 3 16:30:31 PDT 1999 Manish Singh + + * gerror.c (g_on_error_query): check isatty() before querying so + we don't loop endlessly + Sat May 29 11:16:29 PDT 1999 Manish Singh * acinclude.m4 diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 8ea497d2c..448f9efcb 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +Thu Jun 3 16:30:31 PDT 1999 Manish Singh + + * gerror.c (g_on_error_query): check isatty() before querying so + we don't loop endlessly + Sat May 29 11:16:29 PDT 1999 Manish Singh * acinclude.m4 diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 8ea497d2c..448f9efcb 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,8 @@ +Thu Jun 3 16:30:31 PDT 1999 Manish Singh + + * gerror.c (g_on_error_query): check isatty() before querying so + we don't loop endlessly + Sat May 29 11:16:29 PDT 1999 Manish Singh * acinclude.m4 diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 8ea497d2c..448f9efcb 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +Thu Jun 3 16:30:31 PDT 1999 Manish Singh + + * gerror.c (g_on_error_query): check isatty() before querying so + we don't loop endlessly + Sat May 29 11:16:29 PDT 1999 Manish Singh * acinclude.m4 diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 8ea497d2c..448f9efcb 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +Thu Jun 3 16:30:31 PDT 1999 Manish Singh + + * gerror.c (g_on_error_query): check isatty() before querying so + we don't loop endlessly + Sat May 29 11:16:29 PDT 1999 Manish Singh * acinclude.m4 diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 8ea497d2c..448f9efcb 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +Thu Jun 3 16:30:31 PDT 1999 Manish Singh + + * gerror.c (g_on_error_query): check isatty() before querying so + we don't loop endlessly + Sat May 29 11:16:29 PDT 1999 Manish Singh * acinclude.m4 diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 8ea497d2c..448f9efcb 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +Thu Jun 3 16:30:31 PDT 1999 Manish Singh + + * gerror.c (g_on_error_query): check isatty() before querying so + we don't loop endlessly + Sat May 29 11:16:29 PDT 1999 Manish Singh * acinclude.m4 diff --git a/gbacktrace.c b/gbacktrace.c index af5522347..ba81b5f63 100644 --- a/gbacktrace.c +++ b/gbacktrace.c @@ -111,7 +111,14 @@ g_on_error_query (const gchar *prg_name) query3); fflush (stdout); - fgets (buf, 8, stdin); +#ifndef NATIVE_WIN32 + if (isatty(0) && isatty(1)) + fgets (buf, 8, stdin); + else + strcpy (buf, "E\n"); +#else + fgets (buf, 8, stdin); +#endif if ((buf[0] == 'E' || buf[0] == 'e') && buf[1] == '\n') diff --git a/gerror.c b/gerror.c index af5522347..ba81b5f63 100644 --- a/gerror.c +++ b/gerror.c @@ -111,7 +111,14 @@ g_on_error_query (const gchar *prg_name) query3); fflush (stdout); - fgets (buf, 8, stdin); +#ifndef NATIVE_WIN32 + if (isatty(0) && isatty(1)) + fgets (buf, 8, stdin); + else + strcpy (buf, "E\n"); +#else + fgets (buf, 8, stdin); +#endif if ((buf[0] == 'E' || buf[0] == 'e') && buf[1] == '\n') diff --git a/glib/gbacktrace.c b/glib/gbacktrace.c index af5522347..ba81b5f63 100644 --- a/glib/gbacktrace.c +++ b/glib/gbacktrace.c @@ -111,7 +111,14 @@ g_on_error_query (const gchar *prg_name) query3); fflush (stdout); - fgets (buf, 8, stdin); +#ifndef NATIVE_WIN32 + if (isatty(0) && isatty(1)) + fgets (buf, 8, stdin); + else + strcpy (buf, "E\n"); +#else + fgets (buf, 8, stdin); +#endif if ((buf[0] == 'E' || buf[0] == 'e') && buf[1] == '\n') diff --git a/glib/gerror.c b/glib/gerror.c index af5522347..ba81b5f63 100644 --- a/glib/gerror.c +++ b/glib/gerror.c @@ -111,7 +111,14 @@ g_on_error_query (const gchar *prg_name) query3); fflush (stdout); - fgets (buf, 8, stdin); +#ifndef NATIVE_WIN32 + if (isatty(0) && isatty(1)) + fgets (buf, 8, stdin); + else + strcpy (buf, "E\n"); +#else + fgets (buf, 8, stdin); +#endif if ((buf[0] == 'E' || buf[0] == 'e') && buf[1] == '\n')