diff options
author | Jamey Sharp <jamey@thetovacompany.com> | 2008-05-15 17:13:37 -0700 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2008-05-21 16:26:01 +1000 |
commit | 01cc79edacf626472e3d505b60ac86f7150efa84 (patch) | |
tree | daab51ad2efe98e10f2565835dbff05f26af3826 /kexec/kexec.c | |
parent | 8546d0c0046d79176f80a636ffddf53c4e8a338a (diff) |
Open slurped files in binary mode, on systems where that matters.
Signed-off-by: Jamey Sharp <jamey@thetovacompany.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/kexec.c')
-rw-r--r-- | kexec/kexec.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/kexec/kexec.c b/kexec/kexec.c index b1dbe8f..bbfeac3 100644 --- a/kexec/kexec.c +++ b/kexec/kexec.c @@ -30,6 +30,9 @@ #include <sys/stat.h> #include <unistd.h> #include <fcntl.h> +#ifndef _O_BINARY +#define _O_BINARY 0 +#endif #include <getopt.h> #include <ctype.h> @@ -388,7 +391,7 @@ char *slurp_file(const char *filename, off_t *r_size) *r_size = 0; return 0; } - fd = open(filename, O_RDONLY); + fd = open(filename, O_RDONLY | _O_BINARY); if (fd < 0) { die("Cannot open `%s': %s\n", filename, strerror(errno)); @@ -433,7 +436,7 @@ char *slurp_file_len(const char *filename, off_t size) if (!filename) return 0; - fd = open(filename, O_RDONLY); + fd = open(filename, O_RDONLY | _O_BINARY); if (fd < 0) { fprintf(stderr, "Cannot open %s: %s\n", filename, strerror(errno)); |