aboutsummaryrefslogtreecommitdiff
path: root/src/os/win32/ngx_files.c
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2014-07-05 23:29:47 +0400
committerMaxim Dounin <mdounin@mdounin.ru>2014-07-05 23:29:47 +0400
commit11bbbc051bb8087c327179c0db9afde759926555 (patch)
tree1e0940016bc21cb00a806de9f6aed0b4562f5eb5 /src/os/win32/ngx_files.c
parent31c1715ce6029d6138bd8082034110de0b3b6629 (diff)
downloadnginx-11bbbc051bb8087c327179c0db9afde759926555.tar.gz
nginx-11bbbc051bb8087c327179c0db9afde759926555.zip
Win32: ngx_open_dir() and ngx_close_dir() fixes.
The ngx_open_dir() function changed to restore name passed to it. This fixes removing destination directory in dav module, as caught by dav.t. The ngx_close_dir() function introduced to properly convert errors, as FindClose() returns 0 on error.
Diffstat (limited to 'src/os/win32/ngx_files.c')
-rw-r--r--src/os/win32/ngx_files.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/os/win32/ngx_files.c b/src/os/win32/ngx_files.c
index 32e28b5d4..881ffefb4 100644
--- a/src/os/win32/ngx_files.c
+++ b/src/os/win32/ngx_files.c
@@ -430,6 +430,8 @@ ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir)
dir->dir = FindFirstFile((const char *) name->data, &dir->finddata);
+ name->data[name->len] = '\0';
+
if (dir->dir == INVALID_HANDLE_VALUE) {
return NGX_ERROR;
}
@@ -459,6 +461,17 @@ ngx_read_dir(ngx_dir_t *dir)
ngx_int_t
+ngx_close_dir(ngx_dir_t *dir)
+{
+ if (FindClose(dir->dir) == 0) {
+ return NGX_ERROR;
+ }
+
+ return NGX_OK;
+}
+
+
+ngx_int_t
ngx_open_glob(ngx_glob_t *gl)
{
u_char *p;