This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Specify SA_RESTART when registering the SIGWINCH signal handler


SA_RESTART allows system calls to be restarted across a signal handler.
By specifying this flag we fix the issue where if the user is being
prompted to answer yes or no, and the terminal gets resized in the
meantime, the prompt will think that the user sent an EOF and so it will
take the default action for that prompt (in the case of the quit prompt,
it will quit GDB).

	* tui/tui-win.c (tui_initialize_win): Specify SA_RESTART when
	registering the signal handler.
---
 gdb/tui/tui-win.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 9c7a23f..b117634 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -834,6 +834,9 @@ tui_initialize_win (void)
 
   memset (&old_winch, 0, sizeof (old_winch));
   old_winch.sa_handler = &tui_sigwinch_handler;
+#ifdef SA_RESTART
+  old_winch.sa_flags = SA_RESTART;
+#endif
   sigaction (SIGWINCH, &old_winch, NULL);
 #else
   signal (SIGWINCH, &tui_sigwinch_handler);
-- 
2.1.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]