summaryrefslogtreecommitdiff
path: root/lzf.c
diff options
context:
space:
mode:
authorroot <root>2007-06-23 13:48:22 +0000
committerroot <root>2007-06-23 13:48:22 +0000
commita212c13564366f8389f99248e81d2dedd6bcdab4 (patch)
treeb28b45d6e9a553bbc57a2d3de11bba42eab14813 /lzf.c
parent3abfcd994a7dad841f223bb64bd74fb59d13fef2 (diff)
*** empty log message ***
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);