diff options
author | Pierre Joye <pajoye@php.net> | 2008-09-04 08:05:27 +0000 |
---|---|---|
committer | Pierre Joye <pajoye@php.net> | 2008-09-04 08:05:27 +0000 |
commit | 5ec35396e0ed26cfc7c4856e7ffced4cac75003c (patch) | |
tree | 0cf3eef3ae5911c9ed61d892ecb2caa37766b8a2 /TSRM | |
parent | 9bb39338dbcd429cbc9b4f0da406601c4b593970 (diff) | |
download | php-git-5ec35396e0ed26cfc7c4856e7ffced4cac75003c.tar.gz |
- MFH: #45985, touch on opened file raises a warning
Diffstat (limited to 'TSRM')
-rw-r--r-- | TSRM/tsrm_virtual_cwd.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c index bf3860547e..edbb9d8b07 100644 --- a/TSRM/tsrm_virtual_cwd.c +++ b/TSRM/tsrm_virtual_cwd.c @@ -818,7 +818,6 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func } #endif - add_slash = (use_realpath != CWD_REALPATH) && path_length > 0 && IS_SLASH(resolved_path[path_length-1]); t = CWDG(realpath_cache_ttl) ? 0 : -1; path_length = tsrm_realpath_r(resolved_path, start, path_length, &ll, &t, use_realpath, 0, NULL TSRMLS_CC); @@ -1033,8 +1032,14 @@ static int win32_utime(const char *filename, struct utimbuf *buf) /* {{{ */ BOOL f; HANDLE hFile; - hFile = CreateFile(filename, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, - OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + hFile = CreateFile(filename, GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, NULL, + OPEN_ALWAYS, FILE_FLAG_BACKUP_SEMANTICS, NULL); + + /* OPEN_ALWAYS mode sets the last error to ERROR_ALREADY_EXISTS but + the CreateFile operation succeeds */ + if (GetLastError() == ERROR_ALREADY_EXISTS) { + SetLastError(0); + } if ( hFile == INVALID_HANDLE_VALUE ) { return -1; |