comparison 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
comparison
equal deleted inserted replaced
1979:278a1d3b4dbf 1980:b5263e401884
359 size_t len; 359 size_t len;
360 360
361 gl->dir = FindFirstFile((const char *) gl->pattern, &gl->finddata); 361 gl->dir = FindFirstFile((const char *) gl->pattern, &gl->finddata);
362 362
363 if (gl->dir == INVALID_HANDLE_VALUE) { 363 if (gl->dir == INVALID_HANDLE_VALUE) {
364
365 if (ngx_errno == ERROR_FILE_NOT_FOUND && gl->test) {
366 gl->no_match = 1;
367 return NGX_OK;
368 }
369
364 return NGX_ERROR; 370 return NGX_ERROR;
365 } 371 }
366 372
367 for (p = gl->pattern; *p; p++) { 373 for (p = gl->pattern; *p; p++) {
368 if (*p == '/') { 374 if (*p == '/') {
392 ngx_read_glob(ngx_glob_t *gl, ngx_str_t *name) 398 ngx_read_glob(ngx_glob_t *gl, ngx_str_t *name)
393 { 399 {
394 size_t len; 400 size_t len;
395 ngx_err_t err; 401 ngx_err_t err;
396 402
403 if (gl->no_match) {
404 return NGX_DONE;
405 }
406
397 if (gl->ready) { 407 if (gl->ready) {
398 *name = gl->name; 408 *name = gl->name;
399 409
400 gl->ready = 0; 410 gl->ready = 0;
401 return NGX_OK; 411 return NGX_OK;
441 { 451 {
442 if (gl->name.data) { 452 if (gl->name.data) {
443 ngx_free(gl->name.data); 453 ngx_free(gl->name.data);
444 } 454 }
445 455
456 if (gl->dir == INVALID_HANDLE_VALUE) {
457 return;
458 }
459
446 if (FindClose(gl->dir) == 0) { 460 if (FindClose(gl->dir) == 0) {
447 ngx_log_error(NGX_LOG_ALERT, gl->log, ngx_errno, 461 ngx_log_error(NGX_LOG_ALERT, gl->log, ngx_errno,
448 "FindClose(%s) failed", gl->pattern); 462 "FindClose(%s) failed", gl->pattern);
449 } 463 }
450 } 464 }