diff src/os/win32/ngx_files.c @ 1980:b5263e401884

ignore glob no match error
author Igor Sysoev <igor@sysoev.ru>
date Tue, 29 Apr 2008 09:28:42 +0000
parents f4eb04fd8579
children 13652cba8633
line wrap: on
line diff
--- 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 
     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);