aboutsummaryrefslogtreecommitdiff
path: root/src/os/win32
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/win32')
-rw-r--r--src/os/win32/ngx_files.c14
-rw-r--r--src/os/win32/ngx_files.h6
2 files changed, 19 insertions, 1 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);
diff --git a/src/os/win32/ngx_files.h b/src/os/win32/ngx_files.h
index 799e0b0c4..5f926417c 100644
--- a/src/os/win32/ngx_files.h
+++ b/src/os/win32/ngx_files.h
@@ -184,7 +184,11 @@ ngx_int_t ngx_de_link_info(u_char *name, ngx_dir_t *dir);
typedef struct {
HANDLE dir;
WIN32_FIND_DATA finddata;
- ngx_int_t ready;
+
+ unsigned ready:1;
+ unsigned test:1;
+ unsigned no_match:1;
+
u_char *pattern;
ngx_str_t name;
size_t last;