diff options
author | Igor Sysoev <igor@sysoev.ru> | 2009-04-29 19:28:52 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2009-04-29 19:28:52 +0000 |
commit | ef919756d9970902117af563e7e93465f610e600 (patch) | |
tree | 3b4c29a934718617bf57606321381f9a824ef8ef /src | |
parent | b1e640a3859bb7b5357afe16b0d3791916690e24 (diff) | |
download | nginx-ef919756d9970902117af563e7e93465f610e600.tar.gz nginx-ef919756d9970902117af563e7e93465f610e600.zip |
uniform ngx_file_info() interface with ngx_fd_info()
Diffstat (limited to 'src')
-rw-r--r-- | src/core/ngx_cycle.c | 4 | ||||
-rw-r--r-- | src/core/ngx_file.c | 4 | ||||
-rw-r--r-- | src/core/ngx_open_file_cache.c | 6 | ||||
-rw-r--r-- | src/http/modules/ngx_http_dav_module.c | 8 | ||||
-rw-r--r-- | src/os/win32/ngx_files.c | 4 |
5 files changed, 15 insertions, 11 deletions
diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c index 10d07714b..15f8e8d24 100644 --- a/src/core/ngx_cycle.c +++ b/src/core/ngx_cycle.c @@ -1126,7 +1126,9 @@ ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user) if (user != (ngx_uid_t) NGX_CONF_UNSET_UINT) { ngx_file_info_t fi; - if (ngx_file_info((const char *) file[i].name.data, &fi) == -1) { + if (ngx_file_info((const char *) file[i].name.data, &fi) + == NGX_FILE_ERROR) + { ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, ngx_file_info_n " \"%s\" failed", file[i].name.data); diff --git a/src/core/ngx_file.c b/src/core/ngx_file.c index 6bff833d6..450da5623 100644 --- a/src/core/ngx_file.c +++ b/src/core/ngx_file.c @@ -489,7 +489,9 @@ ngx_create_pathes(ngx_cycle_t *cycle, ngx_uid_t user) { ngx_file_info_t fi; - if (ngx_file_info((const char *) path[i]->name.data, &fi) == -1) { + if (ngx_file_info((const char *) path[i]->name.data, &fi) + == NGX_FILE_ERROR) + { ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, ngx_file_info_n " \"%s\" failed", path[i]->name.data); return NGX_ERROR; diff --git a/src/core/ngx_open_file_cache.c b/src/core/ngx_open_file_cache.c index 6deb0ce0b..e0b434b13 100644 --- a/src/core/ngx_open_file_cache.c +++ b/src/core/ngx_open_file_cache.c @@ -143,7 +143,7 @@ ngx_open_cached_file(ngx_open_file_cache_t *cache, ngx_str_t *name, if (of->test_only) { - if (ngx_file_info(name->data, &fi) == -1) { + if (ngx_file_info(name->data, &fi) == NGX_FILE_ERROR) { of->err = ngx_errno; of->failed = ngx_file_info_n; return NGX_ERROR; @@ -463,7 +463,7 @@ ngx_open_and_stat_file(u_char *name, ngx_open_file_info_t *of, ngx_log_t *log) if (of->fd != NGX_INVALID_FILE) { - if (ngx_file_info(name, &fi) == -1) { + if (ngx_file_info(name, &fi) == NGX_FILE_ERROR) { of->failed = ngx_file_info_n; goto failed; } @@ -474,7 +474,7 @@ ngx_open_and_stat_file(u_char *name, ngx_open_file_info_t *of, ngx_log_t *log) } else if (of->test_dir) { - if (ngx_file_info(name, &fi) == -1) { + if (ngx_file_info(name, &fi) == NGX_FILE_ERROR) { of->failed = ngx_file_info_n; goto failed; } diff --git a/src/http/modules/ngx_http_dav_module.c b/src/http/modules/ngx_http_dav_module.c index f506dde69..84a7672a4 100644 --- a/src/http/modules/ngx_http_dav_module.c +++ b/src/http/modules/ngx_http_dav_module.c @@ -221,7 +221,7 @@ ngx_http_dav_put_handler(ngx_http_request_t *r) temp = &r->request_body->temp_file->file.name; - if (ngx_file_info(path.data, &fi) == -1) { + if (ngx_file_info(path.data, &fi) == NGX_FILE_ERROR) { status = NGX_HTTP_CREATED; } else { @@ -326,7 +326,7 @@ ok: ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "http delete filename: \"%s\"", path.data); - if (ngx_file_info(path.data, &fi) == -1) { + if (ngx_file_info(path.data, &fi) == NGX_FILE_ERROR) { err = ngx_errno; rc = (err == NGX_ENOTDIR) ? NGX_HTTP_CONFLICT : NGX_HTTP_NOT_FOUND; @@ -678,7 +678,7 @@ overwrite_done: ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "http copy to: \"%s\"", copy.path.data); - if (ngx_file_info(copy.path.data, &fi) == -1) { + if (ngx_file_info(copy.path.data, &fi) == NGX_FILE_ERROR) { err = ngx_errno; if (err != NGX_ENOENT) { @@ -712,7 +712,7 @@ overwrite_done: dir = ngx_is_dir(&fi); } - if (ngx_file_info(path.data, &fi) == -1) { + if (ngx_file_info(path.data, &fi) == NGX_FILE_ERROR) { return ngx_http_dav_error(r->connection->log, ngx_errno, NGX_HTTP_NOT_FOUND, ngx_file_info_n, path.data); diff --git a/src/os/win32/ngx_files.c b/src/os/win32/ngx_files.c index e10bce3ae..4397b28a0 100644 --- a/src/os/win32/ngx_files.c +++ b/src/os/win32/ngx_files.c @@ -311,7 +311,7 @@ ngx_file_info(u_char *file, ngx_file_info_t *sb) /* NT4 and Win98 */ if (GetFileAttributesEx((char *) file, GetFileExInfoStandard, &fa) == 0) { - return NGX_ERROR; + return NGX_FILE_ERROR; } sb->dwFileAttributes = fa.dwFileAttributes; @@ -321,7 +321,7 @@ ngx_file_info(u_char *file, ngx_file_info_t *sb) sb->nFileSizeHigh = fa.nFileSizeHigh; sb->nFileSizeLow = fa.nFileSizeLow; - return NGX_OK; + return ~NGX_FILE_ERROR; } |