cvs: TSRM(PHP_5_2) / tsrm_virtual_cwd.c
| From: | Ilia Alshanetsky | Date: | Thu, 28 Sep 2006 15:48:35 +0000 |
| Subject: | cvs: TSRM(PHP_5_2) / tsrm_virtual_cwd.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-5281@lists.php.net to get a copy of this message | ||
iliaa Thu Sep 28 15:48:35 2006 UTC
Modified files: (Branch: PHP_5_2)
/TSRM tsrm_virtual_cwd.c
Log:
Added handling for virtual_file_ex() failures.
# Patch by Nuno
http://cvs.php.net/viewvc.cgi/TSRM/tsrm_virtual_cwd.c?r1=1.74.2.9.2.4&r2=1.74.2.9.2.5&diff_format=u
Index: TSRM/tsrm_virtual_cwd.c
diff -u TSRM/tsrm_virtual_cwd.c:1.74.2.9.2.4 TSRM/tsrm_virtual_cwd.c:1.74.2.9.2.5
--- TSRM/tsrm_virtual_cwd.c:1.74.2.9.2.4 Wed Sep 20 07:35:58 2006
+++ TSRM/tsrm_virtual_cwd.c Thu Sep 28 15:48:35 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: tsrm_virtual_cwd.c,v 1.74.2.9.2.4 2006/09/20 07:35:58 dmitry Exp $ */
+/* $Id: tsrm_virtual_cwd.c,v 1.74.2.9.2.5 2006/09/28 15:48:35 iliaa Exp $ */
#include <sys/types.h>
#include <sys/stat.h>
@@ -661,7 +661,9 @@
}
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, path, NULL, 1);
+ if (virtual_file_ex(&new_state, path, NULL, 1)) {
+ return NULL;
+ }
f = fopen(new_state.cwd, mode);
@@ -698,7 +700,9 @@
int ret;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, filename, NULL, 0);
+ if (virtual_file_ex(&new_state, filename, NULL, 0)) {
+ return -1;
+ }
ret = utime(new_state.cwd, buf);
@@ -713,7 +717,9 @@
int ret;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, filename, NULL, 1);
+ if (virtual_file_ex(&new_state, filename, NULL, 1)) {
+ return -1;
+ }
ret = chmod(new_state.cwd, mode);
@@ -728,7 +734,9 @@
int ret;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, filename, NULL, 0);
+ if (virtual_file_ex(&new_state, filename, NULL, 0)) {
+ return -1;
+ }
if (link) {
#if HAVE_LCHOWN
@@ -751,7 +759,9 @@
int f;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, path, NULL, 1);
+ if (virtual_file_ex(&new_state, path, NULL, 1)) {
+ return -1;
+ }
if (flags & O_CREAT) {
mode_t mode;
@@ -775,7 +785,9 @@
int f;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, path, NULL, 1);
+ if (virtual_file_ex(&new_state, path, NULL, 1)) {
+ return -1;
+ }
f = creat(new_state.cwd, mode);
@@ -790,11 +802,15 @@
int retval;
CWD_STATE_COPY(&old_state, &CWDG(cwd));
- virtual_file_ex(&old_state, oldname, NULL, 0);
+ if (virtual_file_ex(&old_state, oldname, NULL, 0)) {
+ return -1;
+ }
oldname = old_state.cwd;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, newname, NULL, 0);
+ if (virtual_file_ex(&new_state, newname, NULL, 0)) {
+ return -1;
+ }
newname = new_state.cwd;
retval = rename(oldname, newname);
@@ -828,7 +844,9 @@
int retval;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, path, NULL, 0);
+ if (virtual_file_ex(&new_state, path, NULL, 0)) {
+ return -1;
+ }
retval = lstat(new_state.cwd, buf);
@@ -843,7 +861,9 @@
int retval;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, path, NULL, 0);
+ if (virtual_file_ex(&new_state, path, NULL, 0)) {
+ return -1;
+ }
retval = unlink(new_state.cwd);
@@ -857,7 +877,9 @@
int retval;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, pathname, NULL, 1);
+ if (virtual_file_ex(&new_state, pathname, NULL, 1)) {
+ return -1;
+ }
#ifdef TSRM_WIN32
retval = mkdir(new_state.cwd);
@@ -874,7 +896,9 @@
int retval;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, pathname, NULL, 0);
+ if (virtual_file_ex(&new_state, pathname, NULL, 0)) {
+ return -1;
+ }
retval = rmdir(new_state.cwd);
@@ -892,7 +916,9 @@
DIR *retval;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, pathname, NULL, 1);
+ if (virtual_file_ex(&new_state, pathname, NULL, 1)) {
+ return NULL;
+ }
retval = opendir(new_state.cwd);