aboutsummaryrefslogtreecommitdiff
path: root/gzlib.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2012-03-18 09:29:44 -0700
committerMark Adler <madler@alumni.caltech.edu>2012-03-18 09:29:44 -0700
commit8e16df2c3f0dbe0f8a819e1913562073cf721636 (patch)
tree1c91e0b2ccc16ad31c941f5ecfd063776a1bf30d /gzlib.c
parenta1af6e96e35dfc3adfa2acba01883c14115f1090 (diff)
downloadzlib-8e16df2c3f0dbe0f8a819e1913562073cf721636.tar.gz
zlib-8e16df2c3f0dbe0f8a819e1913562073cf721636.tar.bz2
zlib-8e16df2c3f0dbe0f8a819e1913562073cf721636.zip
More fixes for gzopen_w().
Also need to #include <stddef.h> for zlib.h, and need to workaround the inability to use wide characters in constructed error messages with zlib's interface.
Diffstat (limited to '')
-rw-r--r--gzlib.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gzlib.c b/gzlib.c
index b99c26c..e31533b 100644
--- a/gzlib.c
+++ b/gzlib.c
@@ -185,12 +185,13 @@ local gzFile gz_open(path, fd, mode)
185 } 185 }
186 186
187 /* save the path name for error messages */ 187 /* save the path name for error messages */
188 state->path = malloc(strlen(path) + 1); 188# define WPATH "<widepath>"
189 state->path = malloc(strlen(fd == -2 ? WPATH : (path) + 1);
189 if (state->path == NULL) { 190 if (state->path == NULL) {
190 free(state); 191 free(state);
191 return NULL; 192 return NULL;
192 } 193 }
193 strcpy(state->path, path); 194 strcpy(state->path, fd == -2 ? WPATH : path);
194 195
195 /* compute the flags for open() */ 196 /* compute the flags for open() */
196 oflag = 197 oflag =