summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorEvan Lloyd <evan.lloyd@arm.com>2017-01-13 14:13:09 +0000
committerEvan Lloyd <evan.lloyd@arm.com>2017-08-30 14:56:17 +0100
commit55745deaf434a832ecb49daf261b1e6300e4eb13 (patch)
treeb168afa2378f93f795e0c59e57c4cb10fa020a30 /tools
parent77544efbf4545b5ba5133f2bb35f6515b3914975 (diff)
fiptool: Update file open modes with 'b' (for Windows)
Unix does not distinguish binary and text modes. On Windows the 'b' flag (e.g. "rb" instead of "r") is used to indicate that files should be opened in binary mode. This has no impact on Unix, but is needed on Windows to avoid end-of-line issues. Change-Id: I69424c55735d5d563d36c50bedd6357b8e05137e Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/fiptool/fiptool.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/fiptool/fiptool.c b/tools/fiptool/fiptool.c
index 4d80f2f1..02223d99 100644
--- a/tools/fiptool/fiptool.c
+++ b/tools/fiptool/fiptool.c
@@ -285,7 +285,7 @@ static int parse_fip(const char *filename, fip_toc_header_t *toc_header_out)
fip_toc_entry_t *toc_entry;
int terminated = 0;
- fp = fopen(filename, "r");
+ fp = fopen(filename, "rb");
if (fp == NULL)
log_err("fopen %s", filename);
@@ -376,7 +376,7 @@ static image_t *read_image_from_file(const uuid_t *uuid, const char *filename)
assert(uuid != NULL);
- fp = fopen(filename, "r");
+ fp = fopen(filename, "rb");
if (fp == NULL)
log_err("fopen %s", filename);
@@ -398,7 +398,7 @@ static int write_image_to_file(const image_t *image, const char *filename)
{
FILE *fp;
- fp = fopen(filename, "w");
+ fp = fopen(filename, "wb");
if (fp == NULL)
log_err("fopen");
xfwrite(image->buffer, image->toc_e.size, fp, filename);
@@ -534,7 +534,7 @@ static int pack_images(const char *filename, uint64_t toc_flags, unsigned long a
toc_entry->offset_address = entry_offset;
/* Generate the FIP file. */
- fp = fopen(filename, "w");
+ fp = fopen(filename, "wb");
if (fp == NULL)
log_err("fopen %s", filename);