summaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/ngx_file.c33
-rw-r--r--src/core/ngx_open_file_cache.c2
-rw-r--r--src/core/ngx_output_chain.c4
3 files changed, 24 insertions, 15 deletions
diff --git a/src/core/ngx_file.c b/src/core/ngx_file.c
index 45bb4ca4f..6844849ad 100644
--- a/src/core/ngx_file.c
+++ b/src/core/ngx_file.c
@@ -183,7 +183,15 @@ ngx_create_full_path(u_char *dir, ngx_uint_t access)
u_char *p, ch;
ngx_err_t err;
- for (p = dir + 1; *p; p++) {
+ err = 0;
+
+#if (NGX_WIN32)
+ p = dir + 3;
+#else
+ p = dir + 1;
+#endif
+
+ for ( /* void */ ; *p; p++) {
ch = *p;
if (ch != '/') {
@@ -194,7 +202,14 @@ ngx_create_full_path(u_char *dir, ngx_uint_t access)
if (ngx_create_dir(dir, access) == NGX_FILE_ERROR) {
err = ngx_errno;
- if (err != NGX_EEXIST) {
+
+ switch (err) {
+ case NGX_EEXIST:
+ err = 0;
+ case NGX_EACCES:
+ break;
+
+ default:
return err;
}
}
@@ -202,7 +217,7 @@ ngx_create_full_path(u_char *dir, ngx_uint_t access)
*p = '/';
}
- return 0;
+ return err;
}
@@ -576,16 +591,10 @@ ngx_ext_rename_file(ngx_str_t *src, ngx_str_t *to, ngx_ext_rename_file_t *ext)
#if (NGX_WIN32)
if (err == NGX_EEXIST) {
- if (ngx_win32_rename_file(src, to, ext->log) == NGX_OK) {
+ err = ngx_win32_rename_file(src, to, ext->log);
- if (ngx_rename_file(src->data, to->data) != NGX_FILE_ERROR) {
- return NGX_OK;
- }
-
- err = ngx_errno;
-
- } else {
- err = 0;
+ if (err == 0) {
+ return NGX_OK;
}
}
diff --git a/src/core/ngx_open_file_cache.c b/src/core/ngx_open_file_cache.c
index aa87fd22c..5f6e0b263 100644
--- a/src/core/ngx_open_file_cache.c
+++ b/src/core/ngx_open_file_cache.c
@@ -525,7 +525,7 @@ ngx_open_and_stat_file(u_char *name, ngx_open_file_info_t *of, ngx_log_t *log)
of->fd = fd;
if (of->directio <= ngx_file_size(&fi)) {
- if (ngx_directio_on(fd) == -1) {
+ if (ngx_directio_on(fd) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
ngx_directio_on_n " \"%s\" failed", name);
diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c
index bee7952ca..808addd85 100644
--- a/src/core/ngx_output_chain.c
+++ b/src/core/ngx_output_chain.c
@@ -510,7 +510,7 @@ ngx_output_chain_copy_buf(ngx_output_chain_ctx_t *ctx)
#if (NGX_HAVE_ALIGNED_DIRECTIO)
if (ctx->unaligned) {
- if (ngx_directio_off(src->file->fd) == -1) {
+ if (ngx_directio_off(src->file->fd) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, ngx_errno,
ngx_directio_off_n " \"%s\" failed",
src->file->name.data);
@@ -528,7 +528,7 @@ ngx_output_chain_copy_buf(ngx_output_chain_ctx_t *ctx)
err = ngx_errno;
- if (ngx_directio_on(src->file->fd) == -1) {
+ if (ngx_directio_on(src->file->fd) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, ngx_errno,
ngx_directio_on_n " \"%s\" failed",
src->file->name.data);