Specify SA_RESTART when registering the SIGWINCH signal handler

Message ID CA+C-WL8WeVKgEcFnjZQdLUyWo1ieUVAAD3gkR6g8euVqQnApmQ@mail.gmail.com
State New, archived
Headers

Commit Message

Patrick Palka Nov. 16, 2014, 3:51 a.m. UTC
  On Thu, Sep 4, 2014 at 6:45 AM, Pedro Alves <palves@redhat.com> wrote:
> On 08/30/2014 08:40 PM, Patrick Palka wrote:
>> 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.
>
> OK.
>
> Thanks,
> Pedro Alves

Hi,

Could someone commit this patch (attached) for me?
  

Comments

Joel Brobecker Nov. 23, 2014, 10:14 a.m. UTC | #1
> Could someone commit this patch (attached) for me?

Done.

> From c152b0da4286424050457f66c067923fcf8d330a Mon Sep 17 00:00:00 2001
> From: Patrick Palka <patrick@parcs.ath.cx>
> Date: Sat, 30 Aug 2014 15:33:08 -0400
> Subject: [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.

I just added a small "gdb/ChangeLog:" line above your ChangeLog
entry, to make it clear which ChangeLog file we're referring to.

Thanks for the patch,
  

Patch

From c152b0da4286424050457f66c067923fcf8d330a Mon Sep 17 00:00:00 2001
From: Patrick Palka <patrick@parcs.ath.cx>
Date: Sat, 30 Aug 2014 15:33:08 -0400
Subject: [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 d17a1e4..4488da8 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.2.0.rc1.23.gf570943