mirror of
https://github.com/nginx/nginx.git
synced 2025-06-12 13:42:55 +08:00
uniform ngx_file_info() interface with ngx_fd_info()
This commit is contained in:
parent
b1e640a385
commit
ef919756d9
@ -1126,7 +1126,9 @@ ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user)
|
|||||||
if (user != (ngx_uid_t) NGX_CONF_UNSET_UINT) {
|
if (user != (ngx_uid_t) NGX_CONF_UNSET_UINT) {
|
||||||
ngx_file_info_t fi;
|
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_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
|
||||||
ngx_file_info_n " \"%s\" failed",
|
ngx_file_info_n " \"%s\" failed",
|
||||||
file[i].name.data);
|
file[i].name.data);
|
||||||
|
@ -489,7 +489,9 @@ ngx_create_pathes(ngx_cycle_t *cycle, ngx_uid_t user)
|
|||||||
{
|
{
|
||||||
ngx_file_info_t fi;
|
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_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
|
||||||
ngx_file_info_n " \"%s\" failed", path[i]->name.data);
|
ngx_file_info_n " \"%s\" failed", path[i]->name.data);
|
||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
|
@ -143,7 +143,7 @@ ngx_open_cached_file(ngx_open_file_cache_t *cache, ngx_str_t *name,
|
|||||||
|
|
||||||
if (of->test_only) {
|
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->err = ngx_errno;
|
||||||
of->failed = ngx_file_info_n;
|
of->failed = ngx_file_info_n;
|
||||||
return NGX_ERROR;
|
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 (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;
|
of->failed = ngx_file_info_n;
|
||||||
goto failed;
|
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) {
|
} 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;
|
of->failed = ngx_file_info_n;
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ ngx_http_dav_put_handler(ngx_http_request_t *r)
|
|||||||
|
|
||||||
temp = &r->request_body->temp_file->file.name;
|
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;
|
status = NGX_HTTP_CREATED;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -326,7 +326,7 @@ ok:
|
|||||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||||
"http delete filename: \"%s\"", path.data);
|
"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;
|
err = ngx_errno;
|
||||||
|
|
||||||
rc = (err == NGX_ENOTDIR) ? NGX_HTTP_CONFLICT : NGX_HTTP_NOT_FOUND;
|
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,
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||||
"http copy to: \"%s\"", copy.path.data);
|
"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;
|
err = ngx_errno;
|
||||||
|
|
||||||
if (err != NGX_ENOENT) {
|
if (err != NGX_ENOENT) {
|
||||||
@ -712,7 +712,7 @@ overwrite_done:
|
|||||||
dir = ngx_is_dir(&fi);
|
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,
|
return ngx_http_dav_error(r->connection->log, ngx_errno,
|
||||||
NGX_HTTP_NOT_FOUND, ngx_file_info_n,
|
NGX_HTTP_NOT_FOUND, ngx_file_info_n,
|
||||||
path.data);
|
path.data);
|
||||||
|
@ -311,7 +311,7 @@ ngx_file_info(u_char *file, ngx_file_info_t *sb)
|
|||||||
/* NT4 and Win98 */
|
/* NT4 and Win98 */
|
||||||
|
|
||||||
if (GetFileAttributesEx((char *) file, GetFileExInfoStandard, &fa) == 0) {
|
if (GetFileAttributesEx((char *) file, GetFileExInfoStandard, &fa) == 0) {
|
||||||
return NGX_ERROR;
|
return NGX_FILE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
sb->dwFileAttributes = fa.dwFileAttributes;
|
sb->dwFileAttributes = fa.dwFileAttributes;
|
||||||
@ -321,7 +321,7 @@ ngx_file_info(u_char *file, ngx_file_info_t *sb)
|
|||||||
sb->nFileSizeHigh = fa.nFileSizeHigh;
|
sb->nFileSizeHigh = fa.nFileSizeHigh;
|
||||||
sb->nFileSizeLow = fa.nFileSizeLow;
|
sb->nFileSizeLow = fa.nFileSizeLow;
|
||||||
|
|
||||||
return NGX_OK;
|
return ~NGX_FILE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user