aboutsummaryrefslogtreecommitdiff
path: root/src/os/win32/ngx_files.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/win32/ngx_files.c')
-rw-r--r--src/os/win32/ngx_files.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/os/win32/ngx_files.c b/src/os/win32/ngx_files.c
index 9e5feba0e..769519856 100644
--- a/src/os/win32/ngx_files.c
+++ b/src/os/win32/ngx_files.c
@@ -361,6 +361,12 @@ ngx_open_glob(ngx_glob_t *gl)
gl->dir = FindFirstFile((const char *) gl->pattern, &gl->finddata);
if (gl->dir == INVALID_HANDLE_VALUE) {
+
+ if (ngx_errno == ERROR_FILE_NOT_FOUND && gl->test) {
+ gl->no_match = 1;
+ return NGX_OK;
+ }
+
return NGX_ERROR;
}
@@ -394,6 +400,10 @@ ngx_read_glob(ngx_glob_t *gl, ngx_str_t *name)
size_t len;
ngx_err_t err;
+ if (gl->no_match) {
+ return NGX_DONE;
+ }
+
if (gl->ready) {
*name = gl->name;
@@ -443,6 +453,10 @@ ngx_close_glob(ngx_glob_t *gl)
ngx_free(gl->name.data);
}
+ if (gl->dir == INVALID_HANDLE_VALUE) {
+ return;
+ }
+
if (FindClose(gl->dir) == 0) {
ngx_log_error(NGX_LOG_ALERT, gl->log, ngx_errno,
"FindClose(%s) failed", gl->pattern);