diff options
author | Jim Meyering <jim@meyering.net> | 2004-04-15 10:37:59 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2004-04-15 10:37:59 +0000 |
commit | e28e19cbba0ba34df95914f0a656b07b28785ab5 (patch) | |
tree | d74095c07276b7d0159d2a8e85a3b693140e4086 /src | |
parent | 0c40916e6f79e7d34bb1b36ef5b5f1dcc3d47c0c (diff) | |
download | coreutils-e28e19cbba0ba34df95914f0a656b07b28785ab5.tar.xz |
Include getpagesize.h.
(copy_reg): Align I/O buffers to page boundaries.
Diffstat (limited to 'src')
-rw-r--r-- | src/copy.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/copy.c b/src/copy.c index 66ffbf85d..7f52766d1 100644 --- a/src/copy.c +++ b/src/copy.c @@ -33,6 +33,7 @@ #include "dirname.h" #include "error.h" #include "full-write.h" +#include "getpagesize.h" #include "hash.h" #include "hash-pjw.h" #include "path-concat.h" @@ -205,7 +206,8 @@ copy_reg (const char *src_path, const char *dst_path, struct stat const *src_sb) { char *buf; - int buf_size; + size_t buf_size; + size_t buf_alignment; int dest_desc; int source_desc; struct stat sb; @@ -316,7 +318,9 @@ copy_reg (const char *src_path, const char *dst_path, /* Make a buffer with space for a sentinel at the end. */ - buf = alloca (buf_size + sizeof (int)); + buf_alignment = lcm (getpagesize (), sizeof (int)); + buf = alloca (buf_size + sizeof (int) + buf_alignment - 1); + buf = ptr_align (buf, buf_alignment); for (;;) { |