summaryrefslogtreecommitdiff
path: root/com32/rosh
diff options
context:
space:
mode:
authorGene Cumm <gene.cumm@gmail.com>2010-07-02 20:09:24 -0400
committerGene Cumm <gene.cumm@gmail.com>2010-07-07 10:02:18 -0400
commitb35617b3426750bf1301b1f844ec082405da7983 (patch)
tree97509474b6e41e1e19ad0f10eb028d7f7f4bfae2 /com32/rosh
parentb46725feffee6f8492e3cfa009506c614ae2663c (diff)
downloadsyslinux-b35617b3426750bf1301b1f844ec082405da7983.tar.gz
rosh: more: overallocation, better feedback for debug
Diffstat (limited to 'com32/rosh')
-rw-r--r--com32/rosh/rosh.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/com32/rosh/rosh.c b/com32/rosh/rosh.c
index 7ee30fd9..fc247760 100644
--- a/com32/rosh/rosh.c
+++ b/com32/rosh/rosh.c
@@ -877,13 +877,15 @@ void rosh_more(const char *cmdstr)
int cmdpos;
int rows, cols;
char *scrbuf;
+ int ret;
ROSH_DEBUG("CMD: '%s'\n", cmdstr);
/* Initialization */
filestr[0] = 0;
cmdpos = 0;
- if (getscreensize(1, &rows, &cols)) {
- ROSH_DEBUG("getscreensize() fail; fall back\n");
+ ret = getscreensize(1, &rows, &cols);
+ if (ret) {
+ ROSH_DEBUG("getscreensize() fail(%d); fall back\n", ret);
ROSH_DEBUG("\tROWS='%d'\tCOLS='%d'\n", rows, cols);
/* If either fail, go under normal size, just in case */
if (!rows)
@@ -892,7 +894,8 @@ void rosh_more(const char *cmdstr)
cols = 75;
}
ROSH_DEBUG("\tUSE ROWS='%d'\tCOLS='%d'\n", rows, cols);
- scrbuf = calloc(rows, cols + 1);
+ /* 32 bit align beginning of row and over allocate */
+ scrbuf = malloc(rows * ((cols+3)&(INT_MAX - 3)));
if (!scrbuf)
return;