summaryrefslogtreecommitdiffstats
path: root/src/strings.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/strings.c')
-rw-r--r--src/strings.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/strings.c b/src/strings.c
index d214356c..8e2d098c 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -180,7 +180,7 @@ main (int argc, char *argv[])
do
{
int fd = (strcmp (argv[remaining], "-") == 0
- ? STDIN_FILENO : open (argv[remaining], O_RDONLY));
+ ? STDIN_FILENO : open (argv[remaining], O_RDONLY | O_BINARY));
if (unlikely (fd == -1))
{
error (0, errno, gettext ("cannot open '%s'"), argv[remaining]);
@@ -450,6 +450,9 @@ process_chunk (const char *fname, const unsigned char *buf, off_t to,
*unprinted = xstrndup ((const char *) start, curlen);
}
+#ifndef roundup
+#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
+#endif
/* Map a file in as large chunks as possible. */
static void *
@@ -571,9 +574,11 @@ read_block (int fd, const char *fname, off_t fdlen, off_t from, off_t to)
elfmap_off = from & ~(ps - 1);
elfmap_base = elfmap = map_file (fd, elfmap_off, fdlen, &elfmap_size);
+#if HAVE_DECL_POSIX_FADVISE
if (unlikely (elfmap == MAP_FAILED))
/* Let the kernel know we are going to read everything in sequence. */
(void) posix_fadvise (fd, 0, 0, POSIX_FADV_SEQUENTIAL);
+#endif
}
if (unlikely (elfmap == MAP_FAILED))