summaryrefslogtreecommitdiff
path: root/bin/cp
diff options
context:
space:
mode:
Diffstat (limited to 'bin/cp')
-rw-r--r--bin/cp/cp.c4
-rw-r--r--bin/cp/path.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/bin/cp/cp.c b/bin/cp/cp.c
index e21bba631e9d..97375b17d1a1 100644
--- a/bin/cp/cp.c
+++ b/bin/cp/cp.c
@@ -299,7 +299,7 @@ copy_file(fs, dne)
struct stat *fs;
int dne;
{
- static char buf[MAXBSIZE];
+ static char buf[MAXBSIZE * 4];
register int from_fd, to_fd, rcount, wcount;
struct stat to_stat;
char *p;
@@ -358,7 +358,7 @@ copy_file(fs, dne)
if (munmap((caddr_t) p, fs->st_size) < 0)
err("%s: %s", from.p_path, strerror(errno));
} else {
- while ((rcount = read(from_fd, buf, MAXBSIZE)) > 0) {
+ while ((rcount = read(from_fd, buf, sizeof(buf))) > 0) {
wcount = write(to_fd, buf, rcount);
if (rcount != wcount || wcount == -1) {
err("%s: %s", to.p_path, strerror(errno));
diff --git a/bin/cp/path.c b/bin/cp/path.c
index a84892193554..170460283522 100644
--- a/bin/cp/path.c
+++ b/bin/cp/path.c
@@ -50,7 +50,7 @@ static char sccsid[] = "@(#)path.c 5.2 (Berkeley) 10/27/91";
*/
#define STRIP_TRAILING_SLASH(p) { \
- while ((p)->p_end > (p)->p_path && (p)->p_end[-1] == '/') \
+ while ((p)->p_end > ((p)->p_path + 1) && (p)->p_end[-1] == '/') \
*--(p)->p_end = 0; \
}