From a212c13564366f8389f99248e81d2dedd6bcdab4 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 23 Jun 2007 13:48:22 +0000 Subject: *** empty log message *** --- lzf.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lzf.c') 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); -- cgit v1.2.3