On Mon, May 21, 2012 at 12:00:18PM +0200, Nikola Pajkovsky wrote:
Ricardo Catalinas Jiménez <jimenezrick(a)gmail.com> writes:
> 1. Using iptraf-ng 1.1.2 on Arch Linux x86_64, window resize seems
> broken. A segmentation fault happens when the terminal size changes.
> But probably you are aware of this bug :-/
I'm aware of this bug, but I cannot reproduce it on my machine. What
size are you using?
For me it segfaults for these widths: 83, 91, 99, 107, 115, 123, ...
Could you please try patch
Yes, this one cures it.
Signed-off-by: Vitezslav Samel <vitezslav(a)samel.cz>
diff --git a/src/tui/winops.c b/src/tui/winops.c
index 139e8ce..a0c0e6b 100644
--- a/src/tui/winops.c
+++ b/src/tui/winops.c
@@ -31,16 +31,16 @@ void tx_colorwin(WINDOW * win)
{
int ctr;
char *blankpad;
- blankpad = (char *) malloc(sizeof(char) * (COLS + 1));
+ blankpad = (char *) xmalloc(sizeof(char) * (getmaxx(win) + 1));
strcpy(blankpad, "");
- for (ctr = 0; ctr <= getmaxx(win); ctr++) {
+ for (ctr = 0; ctr < getmaxx(win); ctr++) {
strcat(blankpad, " ");
}
scrollok(win, 0);
- for (ctr = 0; ctr <= getmaxy(win); ctr++) {
+ for (ctr = 0; ctr < getmaxy(win); ctr++) {
wmove(win, ctr, 0);
wprintw(win, "%s", blankpad);
}
Cheers,
Vita