summaryrefslogtreecommitdiff
path: root/lzf.c
diff options
context:
space:
mode:
Diffstat (limited to 'lzf.c')
-rw-r--r--lzf.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/lzf.c b/lzf.c
index d4f4ef4..f10058e 100644
--- a/lzf.c
+++ b/lzf.c
@@ -323,6 +323,9 @@ open_out (const char *name)
m = 0;
fd = open (name, O_CREAT | O_WRONLY | O_TRUNC | m, 600);
+#if defined(__MINGW32__)
+ _setmode(fd, _O_BINARY);
+#endif
return fd;
}
@@ -376,8 +379,15 @@ run_file (const char *fname)
if (compose_name (fname, oname))
return -1;
+#if !defined(__MINGW32__)
rc = lstat (fname, &mystat);
+#else
+ rc = stat (fname, &mystat);
+#endif
fd = open (fname, O_RDONLY);
+#if defined(__MINGW32__)
+ _setmode(fd, _O_BINARY);
+#endif
if (rc || fd == -1)
{
fprintf (stderr, "%s: %s: ", imagename, fname);
@@ -423,7 +433,11 @@ run_file (const char *fname)
fname, nr_written == 0 ? 0 : 100.0 - nr_read / ((double) nr_written / 100.0), oname);
}
+#if !defined(__MINGW32__)
fchmod (fd2, mystat.st_mode);
+#else
+ chmod (oname, mystat.st_mode);
+#endif
close (fd);
close (fd2);