From 6d108dc2edfa6b18506940f01ca379ccbc4cca60 Mon Sep 17 00:00:00 2001 From: "Joseph C. Lehner" Date: Wed, 10 Aug 2016 12:32:50 +0200 Subject: [PATCH] Open firmware images in binary mode on Windows --- tftp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tftp.c b/tftp.c index da76dc9..2f65738 100644 --- a/tftp.c +++ b/tftp.c @@ -26,6 +26,10 @@ #include #include "nmrpd.h" +#ifndef O_BINARY +#define O_BINARY 0 +#endif + #define TFTP_PKT_SIZE 516 static const char *opcode_names[] = { @@ -237,7 +241,7 @@ int tftp_put(struct nmrpd_args *args) if (!strcmp(args->file_local, "-")) { fd = STDIN_FILENO; } else { - fd = open(args->file_local, O_RDONLY); + fd = open(args->file_local, O_RDONLY | O_BINARY); if (fd < 0) { perror("open"); ret = fd; -- 2.25.1