From 9a79f1b42c18ebedce15dd9ada35e977be96ef3f Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 2 Oct 2008 21:31:54 +0000 Subject: 2008-10-02 Joel Sherrill * libmisc/shell/utils-cp.c: Do not put a 64K buffer on the stack. --- cpukit/libmisc/shell/utils-cp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'cpukit/libmisc/shell/utils-cp.c') diff --git a/cpukit/libmisc/shell/utils-cp.c b/cpukit/libmisc/shell/utils-cp.c index d2eb0adf51..3da0722572 100644 --- a/cpukit/libmisc/shell/utils-cp.c +++ b/cpukit/libmisc/shell/utils-cp.c @@ -69,6 +69,9 @@ __RCSID("$NetBSD: utils.c,v 1.29 2005/10/15 18:22:18 christos Exp $"); #define cp_pct(x, y) ((y == 0) ? 0 : (int)(100.0 * (x) / (y))) +/* original was MAXBSIZE which results in 64K on the stack */ +#define MAX_READ 1024 + int set_utimes(const char *file, struct stat *fs) { @@ -87,7 +90,7 @@ set_utimes(const char *file, struct stat *fs) int copy_file(rtems_shell_cp_globals* cp_globals, FTSENT *entp, int dne) { - static char buf[MAXBSIZE]; + static char buf[MAX_READ]; struct stat *fs; ssize_t wcount; size_t wresid; @@ -204,7 +207,7 @@ copy_file(rtems_shell_cp_globals* cp_globals, FTSENT *entp, int dne) #endif { wtotal = 0; - while ((rcount = read(from_fd, buf, MAXBSIZE)) > 0) { + while ((rcount = read(from_fd, buf, MAX_READ)) > 0) { for (bufp = buf, wresid = rcount; ; bufp += wcount, wresid -= wcount) { wcount = write(to_fd, bufp, wresid); -- cgit v1.2.3