summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/shell/utils-cp.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-10-02 21:31:54 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-10-02 21:31:54 +0000
commit9a79f1b42c18ebedce15dd9ada35e977be96ef3f (patch)
tree727e6f02a94b8e4e42f16fa725626b1ce9ffe492 /cpukit/libmisc/shell/utils-cp.c
parent2008-10-02 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-9a79f1b42c18ebedce15dd9ada35e977be96ef3f.tar.bz2
2008-10-02 Joel Sherrill <joel.sherrill@oarcorp.com>
* libmisc/shell/utils-cp.c: Do not put a 64K buffer on the stack.
Diffstat (limited to 'cpukit/libmisc/shell/utils-cp.c')
-rw-r--r--cpukit/libmisc/shell/utils-cp.c7
1 files changed, 5 insertions, 2 deletions
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);