com php-src: preserve the error code: Zend/zend_virtual_cwd .c

From: Date: Fri, 18 Oct 2013 12:01:16 +0000
Subject: com php-src: preserve the error code: Zend/zend_virtual_cwd .c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-73879@lists.php.net to get a copy of this message
Commit: 515ef09b62c6d47b79aad5d87db17b8f0bb15f7a Author: Anatol Belski <ab@php.net> Fri, 18 Oct 2013 05:01:16 -0700 Parents: cf6ab0e915f95f01a8db1ce7daf70ed36cf49c66 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=515ef09b62c6d47b79aad5d87db17b8f0bb15f7a Log: preserve the error code otherwise it'd be cleared by a subsequent calls Changed paths: M Zend/zend_virtual_cwd.c Diff: diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c index 968390d..e171386 100644 --- a/Zend/zend_virtual_cwd.c +++ b/Zend/zend_virtual_cwd.c @@ -1695,6 +1695,9 @@ CWD_API int virtual_rename(const char *oldname, const char *newname TSRMLS_DC) / cwd_state old_state; cwd_state new_state; int retval; +#ifdef TSRM_WIN32 + DWORD last_error; +#endif CWD_STATE_COPY(&old_state, &CWDG(cwd)); if (virtual_file_ex(&old_state, oldname, NULL, CWD_EXPAND TSRMLS_CC)) { @@ -1716,6 +1719,7 @@ CWD_API int virtual_rename(const char *oldname, const char *newname TSRMLS_DC) / #ifdef TSRM_WIN32 /* MoveFileEx returns 0 on failure, other way 'round for this function */ retval = (MoveFileEx(oldname, newname, MOVEFILE_REPLACE_EXISTING|MOVEFILE_COPY_ALLOWED) == 0) ? -1 : 0; + last_error = GetLastError(); #else retval = rename(oldname, newname); #endif @@ -1723,6 +1727,10 @@ CWD_API int virtual_rename(const char *oldname, const char *newname TSRMLS_DC) / CWD_STATE_FREE(&old_state); CWD_STATE_FREE(&new_state); +#ifdef TSRM_WIN32 + SetLastError(last_error); +#endif + return retval; } /* }}} */

« previous php.cvs (#73879) next »