From: Marco Felsch <m.felsch@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/4] scripts: common: fix read_file_2 for windows
Date: Tue, 17 Oct 2023 23:36:05 +0200 [thread overview]
Message-ID: <20231017213608.3494255-2-m.felsch@pengutronix.de> (raw)
In-Reply-To: <20231017213608.3494255-1-m.felsch@pengutronix.de>
From: Marco Felsch <marco.felsch@gmail.com>
We need to specify the O_BINARY flag for Windows else the followed
read() may detected a EOF condition.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
scripts/common.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/common.c b/scripts/common.c
index 88173bc977..0599cd41ff 100644
--- a/scripts/common.c
+++ b/scripts/common.c
@@ -11,6 +11,7 @@
#include <stdarg.h>
#include "common.h"
+#include "compiler.h"
int read_file_2(const char *filename, size_t *size, void **outbuf, size_t max_size)
{
@@ -22,7 +23,7 @@ int read_file_2(const char *filename, size_t *size, void **outbuf, size_t max_si
*size = 0;
*outbuf = NULL;
- 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));
return -errno;
--
2.41.0
next prev parent reply other threads:[~2023-10-17 21:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-17 21:36 [PATCH 0/4] i.MX USB Loader Windows Fixes Marco Felsch
2023-10-17 21:36 ` Marco Felsch [this message]
2023-10-17 21:36 ` [PATCH 2/4] scripts: common: fix buffer freeing Marco Felsch
2023-10-17 21:36 ` [PATCH 3/4] usb: gadget: fsl_udc: lower state_complete constraints Marco Felsch
2023-10-17 21:36 ` [PATCH 4/4] imx-usb-loader: fix windows usage Marco Felsch
2023-10-18 10:46 ` Ahmad Fatoum
2023-10-18 12:53 ` Marco Felsch
2023-10-18 13:07 ` Ahmad Fatoum
2023-10-18 14:32 ` Marco Felsch
2023-10-18 8:18 ` [PATCH 0/4] i.MX USB Loader Windows Fixes Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231017213608.3494255-2-m.felsch@pengutronix.de \
--to=m.felsch@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox