Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/os
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
parent31c1715ce6029d6138bd8082034110de0b3b6629 (diff)
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')
-rw-r--r--src/os/win32/ngx_files.c13
-rw-r--r--src/os/win32/ngx_files.h2
2 files changed, 14 insertions, 1 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;
diff --git a/src/os/win32/ngx_files.h b/src/os/win32/ngx_files.h
index 08e5dc67e..aafb5d0b4 100644
--- a/src/os/win32/ngx_files.h
+++ b/src/os/win32/ngx_files.h
@@ -193,7 +193,7 @@ ngx_int_t ngx_read_dir(ngx_dir_t *dir);
#define ngx_read_dir_n "FindNextFile()"
-#define ngx_close_dir(d) FindClose((d)->dir)
+ngx_int_t ngx_close_dir(ngx_dir_t *dir);
#define ngx_close_dir_n "FindClose()"