summaryrefslogtreecommitdiff
path: root/src/split.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2004-04-15 09:10:54 +0000
committerJim Meyering <jim@meyering.net>2004-04-15 09:10:54 +0000
commit5f20d9e92127ea7e56d93ebe25f8754069bd833a (patch)
treef1ce287deb8bad8869e667fe9f874b4d40130821 /src/split.c
parent4b84b6c487774ca3830cc659bb973b986258df13 (diff)
downloadcoreutils-5f20d9e92127ea7e56d93ebe25f8754069bd833a.tar.xz
Include getpagesize.h.
(main): Align I/O buffers to page boundaries.
Diffstat (limited to 'src/split.c')
-rw-r--r--src/split.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/split.c b/src/split.c
index 49422656b..f47a2615d 100644
--- a/src/split.c
+++ b/src/split.c
@@ -30,6 +30,7 @@
#include "system.h"
#include "dirname.h"
#include "error.h"
+#include "getpagesize.h"
#include "full-read.h"
#include "full-write.h"
#include "inttostr.h"
@@ -373,6 +374,7 @@ main (int argc, char **argv)
} split_type = type_undef;
size_t in_blk_size; /* optimal block size of input file device */
char *buf; /* file i/o buffer */
+ size_t page_size = getpagesize ();
uintmax_t n_units;
int c;
int digits_optind = 0;
@@ -555,7 +557,7 @@ main (int argc, char **argv)
error (EXIT_FAILURE, errno, "%s", infile);
in_blk_size = ST_BLKSIZE (stat_buf);
- buf = xmalloc (in_blk_size + 1);
+ buf = ptr_align (xmalloc (in_blk_size + 1 + page_size - 1), page_size);
switch (split_type)
{