aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorDai Sato <satodai@w3m.jp>2006-05-29 12:28:01 +0000
committerDai Sato <satodai@w3m.jp>2006-05-29 12:28:01 +0000
commit44366cf8a5984b9f03ce2a8f2c5ae4988c077cf9 (patch)
tree3b986de7a99df126561b1e7f09995e209fcb442f /main.c
parentAdd SHIFT-TAB as a default binding for PREV_LINK. (diff)
downloadw3m-44366cf8a5984b9f03ce2a8f2c5ae4988c077cf9.tar.gz
w3m-44366cf8a5984b9f03ce2a8f2c5ae4988c077cf9.zip
[w3m-dev-en 01067] fix unsafe usage of SIGWINCH handler.
Diffstat (limited to '')
-rw-r--r--main.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/main.c b/main.c
index 19f29b2..439ca09 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.250 2006/04/08 11:21:07 inu Exp $ */
+/* $Id: main.c,v 1.251 2006/05/29 12:28:01 inu Exp $ */
#define MAINPROGRAM
#include "fm.h"
#include <signal.h>
@@ -51,7 +51,6 @@ static MySignalHandler SigAlarm(SIGNAL_ARG);
#ifdef SIGWINCH
static int need_resize_screen = FALSE;
static MySignalHandler resize_hook(SIGNAL_ARG);
-static MySignalHandler resize_handler(SIGNAL_ARG);
static void resize_screen(void);
#endif
@@ -1084,24 +1083,32 @@ main(int argc, char **argv, char **envp)
}
#endif
#ifdef SIGWINCH
- if (need_resize_screen) {
- need_resize_screen = FALSE;
- resize_screen();
- }
- mySignal(SIGWINCH, resize_handler);
+ mySignal(SIGWINCH, resize_hook);
#endif
#ifdef USE_IMAGE
if (activeImage && displayImage && Currentbuf->img &&
!Currentbuf->image_loaded) {
do {
+#ifdef SIGWINCH
+ if (need_resize_screen)
+ resize_screen();
+#endif
loadImage(Currentbuf, IMG_FLAG_NEXT);
} while (sleep_till_anykey(1, 0) <= 0);
}
+#ifdef SIGWINCH
+ else
+#endif
#endif
- c = getch();
#ifdef SIGWINCH
- mySignal(SIGWINCH, resize_hook);
+ {
+ do {
+ if (need_resize_screen)
+ resize_screen();
+ } while (sleep_till_anykey(1, 0) <= 0);
+ }
#endif
+ c = getch();
#ifdef USE_ALARM
if (CurrentAlarm->sec > 0) {
alarm(0);
@@ -1427,17 +1434,10 @@ resize_hook(SIGNAL_ARG)
SIGNAL_RETURN;
}
-static MySignalHandler
-resize_handler(SIGNAL_ARG)
-{
- resize_screen();
- mySignal(SIGWINCH, resize_handler);
- SIGNAL_RETURN;
-}
-
static void
resize_screen(void)
{
+ need_resize_screen = FALSE;
setlinescols();
setupscreen();
if (CurrentTab)