Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/top/dist PR/45739: Moritz Wilhelmy: top(1) segf...
details: https://anonhg.NetBSD.org/src/rev/36adb189368f
branches: trunk
changeset: 772217:36adb189368f
user: christos <christos%NetBSD.org@localhost>
date: Sat Dec 24 22:29:48 2011 +0000
description:
PR/45739: Moritz Wilhelmy: top(1) segfaults on WINCH with unknown terminal
diffstat:
external/bsd/top/dist/screen.c | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diffs (55 lines):
diff -r 40e0be32330b -r 36adb189368f external/bsd/top/dist/screen.c
--- a/external/bsd/top/dist/screen.c Sat Dec 24 20:18:54 2011 +0000
+++ b/external/bsd/top/dist/screen.c Sat Dec 24 22:29:48 2011 +0000
@@ -167,7 +167,7 @@
screen_getsize()
{
-
+ char *go;
#ifdef TIOCGWINSZ
struct winsize ws;
@@ -204,7 +204,10 @@
#endif /* TIOCGSIZE */
#endif /* TIOCGWINSZ */
- (void) strcpy(lower_left, tgoto(tc_cursor_motion, 0, screen_length - 1));
+ if ((go = tgoto(tc_cursor_motion, 0, screen_length - 1)) != NULL)
+ (void) strcpy(lower_left, go);
+ else
+ lower_left[0] = '\0';
}
int
@@ -214,6 +217,7 @@
char *bufptr;
char *PCptr;
char *term_name;
+ char *go;
int status;
/* set defaults in case we aren't smart */
@@ -314,7 +318,10 @@
PC = (PCptr = tgetstr("pc", &bufptr)) ? *PCptr : 0;
/* set convenience strings */
- (void) strcpy(home, tgoto(tc_cursor_motion, 0, 0));
+ if ((go = tgoto(tc_cursor_motion, 0, 0)) != NULL)
+ (void) strcpy(home, go);
+ else
+ home[0] = '\0';
/* (lower_left is set in screen_getsize) */
/* get the actual screen size with an ioctl, if needed */
@@ -502,7 +509,9 @@
screen_move(int x, int y)
{
- tputs(tgoto(tc_cursor_motion, x, y), 1, putstdout);
+ char *go = tgoto(tc_cursor_motion, x, y);
+ if (go)
+ tputs(go, 1, putstdout);
}
void
Home |
Main Index |
Thread Index |
Old Index