From: Gene Cumm Date: Sat, 3 Jul 2010 00:09:24 +0000 (-0400) Subject: rosh: more: overallocation, better feedback for debug X-Git-Tag: syslinux-4.04-pre1~47 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b35617b3426750bf1301b1f844ec082405da7983;p=platform%2Fupstream%2Fsyslinux.git rosh: more: overallocation, better feedback for debug --- diff --git a/com32/rosh/rosh.c b/com32/rosh/rosh.c index 7ee30fd..fc24776 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;