From 09628cb2c3d7f2a5a01579ba54b7b610513e2e27 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Tue, 10 Jan 2017 15:21:26 -0500 Subject: [PATCH] O_BINARY flag. --- omf.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/omf.cpp b/omf.cpp index c384c22..6ae3ccf 100644 --- a/omf.cpp +++ b/omf.cpp @@ -9,6 +9,11 @@ #include #include + +#ifndef O_BINARY +#define O_BINARY 0 +#endif + #pragma pack(push, 1) struct omf_header { uint32_t bytecount = 0; @@ -70,7 +75,7 @@ void save_omf(std::vector &segments, bool expressload, const std:: } int fd; - fd = open(path.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0666); + fd = open(path.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666); if (fd < 0) { err(EX_CANTCREAT, "Unable to open %s", path.c_str()); }