applied and fixed the original patch

initial work on the patch import done
This commit is contained in:
Anatol Belski 2013-10-17 10:40:43 +02:00
parent e30b2aae5a
commit cf6ab0e915
9 changed files with 106 additions and 79 deletions

View file

@ -124,11 +124,11 @@ static int php_do_open_temporary_file(const char *path, const char *pfx, char **
cwd[0] = '\0';
}
new_state.cwd = strdup(cwd);
new_state.cwd = estrdup(cwd);
new_state.cwd_length = strlen(cwd);
if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH TSRMLS_CC)) {
free(new_state.cwd);
efree(new_state.cwd);
return -1;
}
@ -140,7 +140,7 @@ static int php_do_open_temporary_file(const char *path, const char *pfx, char **
if (spprintf(&opened_path, 0, "%s%s%sXXXXXX", new_state.cwd, trailing_slash, pfx) >= MAXPATHLEN) {
efree(opened_path);
free(new_state.cwd);
efree(new_state.cwd);
return -1;
}
@ -151,7 +151,7 @@ static int php_do_open_temporary_file(const char *path, const char *pfx, char **
* which means that opening it will fail... */
if (VCWD_CHMOD(opened_path, 0600)) {
efree(opened_path);
free(new_state.cwd);
efree(new_state.cwd);
return -1;
}
fd = VCWD_OPEN_MODE(opened_path, open_flags, 0600);
@ -170,7 +170,7 @@ static int php_do_open_temporary_file(const char *path, const char *pfx, char **
} else {
*opened_path_p = opened_path;
}
free(new_state.cwd);
efree(new_state.cwd);
return fd;
}
/* }}} */