aboutsummaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--ChangeLog9
-rw-r--r--main.c34
2 files changed, 24 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index cd8fbab..daebab3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
-2006-04-08 Dai Sato <satodai@w3m.jp>
+2006-05-29 Dai Sato <satodai@w3m.jp>
+
+ * [w3m-dev-en 01067] Some more patches
+ * main.c: fix unsafe usages of SIGWINCH handler.
+
+2006-05-29 Dai Sato <satodai@w3m.jp>
* [w3m-dev-en 01067] Some more patches
* keybind(_lynx).c, doc(-jp)/keymap.default: add SHIFT-TAB as a default binding for PREV_LINK.
@@ -8713,4 +8718,4 @@ a * [w3m-dev 03276] compile error on EWS4800
* release-0-2-1
* import w3m-0.2.1
-$Id: ChangeLog,v 1.961 2006/05/29 12:17:24 inu Exp $
+$Id: ChangeLog,v 1.962 2006/05/29 12:28:01 inu Exp $
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)