comparison src/core/ngx_file.c @ 6468:a5897d360977

Win32: additional error code NGX_EEXIST_FILE (ticket #910). On Windows there are two possible error codes which correspond to the EEXIST error code: ERROR_FILE_EXISTS used by CreateFile(CREATE_NEW), and ERROR_ALREADY_EXISTS used by CreateDirectory(). MoveFile() seems to use both: ERROR_ALREADY_EXISTS when moving within one filesystem, and ERROR_FILE_EXISTS when copying a file to a different drive.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 29 Mar 2016 09:51:46 +0300
parents 6e10518f95d8
children 2cd019520210
comparison
equal deleted inserted replaced
6467:91c8d990fb45 6468:a5897d360977
194 return NGX_OK; 194 return NGX_OK;
195 } 195 }
196 196
197 err = ngx_errno; 197 err = ngx_errno;
198 198
199 if (err == NGX_EEXIST) { 199 if (err == NGX_EEXIST_FILE) {
200 n = (uint32_t) ngx_next_temp_number(1); 200 n = (uint32_t) ngx_next_temp_number(1);
201 continue; 201 continue;
202 } 202 }
203 203
204 if ((path->level[0] == 0) || (err != NGX_ENOPATH)) { 204 if ((path->level[0] == 0) || (err != NGX_ENOPATH)) {
690 err = ngx_errno; 690 err = ngx_errno;
691 } 691 }
692 692
693 #if (NGX_WIN32) 693 #if (NGX_WIN32)
694 694
695 if (err == NGX_EEXIST) { 695 if (err == NGX_EEXIST || err == NGX_EEXIST_FILE) {
696 err = ngx_win32_rename_file(src, to, ext->log); 696 err = ngx_win32_rename_file(src, to, ext->log);
697 697
698 if (err == 0) { 698 if (err == 0) {
699 return NGX_OK; 699 return NGX_OK;
700 } 700 }