mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02:00
- MFB: restore fix for binary mode on win (regression introduced in 5.2.8)
This commit is contained in:
parent
f652fe1016
commit
f77df832c4
1 changed files with 6 additions and 2 deletions
|
@ -636,13 +636,14 @@ _zip_create_temp_output(struct zip *za, FILE **outp)
|
||||||
char *temp;
|
char *temp;
|
||||||
int tfd;
|
int tfd;
|
||||||
FILE *tfp;
|
FILE *tfp;
|
||||||
|
int len = strlen(za->zn) + 8;
|
||||||
|
|
||||||
if ((temp=(char *)malloc(strlen(za->zn)+8)) == NULL) {
|
if ((temp=(char *)malloc(len)) == NULL) {
|
||||||
_zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
|
_zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(temp, "%s.XXXXXX", za->zn);
|
snprintf(temp, len, "%s.XXXXXX", za->zn);
|
||||||
|
|
||||||
if ((tfd=mkstemp(temp)) == -1) {
|
if ((tfd=mkstemp(temp)) == -1) {
|
||||||
_zip_error_set(&za->error, ZIP_ER_TMPOPEN, errno);
|
_zip_error_set(&za->error, ZIP_ER_TMPOPEN, errno);
|
||||||
|
@ -657,6 +658,9 @@ _zip_create_temp_output(struct zip *za, FILE **outp)
|
||||||
free(temp);
|
free(temp);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#ifdef PHP_WIN32
|
||||||
|
_setmode(_fileno(tfp), _O_BINARY );
|
||||||
|
#endif
|
||||||
|
|
||||||
*outp = tfp;
|
*outp = tfp;
|
||||||
return temp;
|
return temp;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue