summaryrefslogtreecommitdiff
path: root/gzlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'gzlib.c')
-rw-r--r--gzlib.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gzlib.c b/gzlib.c
index ca55c6e..b021372 100644
--- a/gzlib.c
+++ b/gzlib.c
@@ -208,7 +208,11 @@ local gzFile gz_open(path, fd, mode)
208 *(state->path) = 0; 208 *(state->path) = 0;
209 else 209 else
210#endif 210#endif
211#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
212 snprintf(state->path, len + 1, "%s", (const char *)path);
213#else
211 strcpy(state->path, path); 214 strcpy(state->path, path);
215#endif
212 216
213 /* compute the flags for open() */ 217 /* compute the flags for open() */
214 oflag = 218 oflag =
@@ -284,7 +288,11 @@ gzFile ZEXPORT gzdopen(fd, mode)
284 288
285 if (fd == -1 || (path = malloc(7 + 3 * sizeof(int))) == NULL) 289 if (fd == -1 || (path = malloc(7 + 3 * sizeof(int))) == NULL)
286 return NULL; 290 return NULL;
291#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
292 snprintf(path, 7 + 3 * sizeof(int), "<fd:%d>", fd); /* for debugging */
293#else
287 sprintf(path, "<fd:%d>", fd); /* for debugging */ 294 sprintf(path, "<fd:%d>", fd); /* for debugging */
295#endif
288 gz = gz_open(path, fd, mode); 296 gz = gz_open(path, fd, mode);
289 free(path); 297 free(path);
290 return gz; 298 return gz;
@@ -594,9 +602,14 @@ void ZLIB_INTERNAL gz_error(state, err, msg)
594 state->msg = (char *)"out of memory"; 602 state->msg = (char *)"out of memory";
595 return; 603 return;
596 } 604 }
605#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
606 snprintf(state->msg, strlen(state->path) + strlen(msg) + 3,
607 "%s%s%s", state->path, ": ", msg);
608#else
597 strcpy(state->msg, state->path); 609 strcpy(state->msg, state->path);
598 strcat(state->msg, ": "); 610 strcat(state->msg, ": ");
599 strcat(state->msg, msg); 611 strcat(state->msg, msg);
612#endif
600 return; 613 return;
601} 614}
602 615