From 892c00bb9f8ab68a870de5ec7f252d88048c69a4 Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Wed, 15 Nov 2006 19:14:02 +0000 Subject: #9278 and #39506, force the binary mode for the zip operation only. At least I do not have to set/restore it in each function. --- ext/zip/lib/zip_open.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'ext/zip/lib/zip_open.c') diff --git a/ext/zip/lib/zip_open.c b/ext/zip/lib/zip_open.c index c8d45146db..f2f3cc3bc4 100644 --- a/ext/zip/lib/zip_open.c +++ b/ext/zip/lib/zip_open.c @@ -75,10 +75,6 @@ zip_open(const char *fn, int flags, int *zep) return NULL; } -#ifdef PHP_WIN32 - _fmode = _O_BINARY; -#endif - if (flags & ZIP_OVERWRITE || stat(fn, &st) != 0) { if ((flags & ZIP_CREATE) || (flags & ZIP_OVERWRITE)) { if ((za=_zip_new(&error)) == NULL) { @@ -104,7 +100,6 @@ zip_open(const char *fn, int flags, int *zep) return NULL; } - /* ZIP_CREATE gets ignored if file exists and not ZIP_EXCL, just like open() */ if ((fp=fopen(fn, "rb")) == NULL) { @@ -112,6 +107,10 @@ zip_open(const char *fn, int flags, int *zep) return NULL; } +#ifdef PHP_WIN32 + _setmode(_fileno(fp), _O_BINARY ); +#endif + clearerr(fp); fseek(fp, 0, SEEK_END); len = ftell(fp); -- cgit v1.2.1