mirror of
https://github.com/nginx/nginx.git
synced 2025-06-08 02:02:38 +08:00
Disable symlinks: added explicit cast of AT_FDCWD (ticket #111).
Solaris has AT_FDCWD defined to unsigned value, and comparison of a file descriptor with it causes warnings in modern versions of gcc. Explicitly cast AT_FDCWD to ngx_fd_t to resolve these warnings.
This commit is contained in:
parent
6bb86e3d58
commit
7ba66f42a0
@ -582,7 +582,7 @@ ngx_open_file_wrapper(ngx_str_t *name, ngx_open_file_info_t *of,
|
|||||||
p = name->data;
|
p = name->data;
|
||||||
end = p + name->len;
|
end = p + name->len;
|
||||||
|
|
||||||
at_fd = AT_FDCWD;
|
at_fd = NGX_AT_FDCWD;
|
||||||
at_name = *name;
|
at_name = *name;
|
||||||
|
|
||||||
if (p[0] == '/') {
|
if (p[0] == '/') {
|
||||||
@ -632,7 +632,7 @@ ngx_open_file_wrapper(ngx_str_t *name, ngx_open_file_info_t *of,
|
|||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (at_fd != AT_FDCWD && ngx_close_file(at_fd) == NGX_FILE_ERROR) {
|
if (at_fd != NGX_AT_FDCWD && ngx_close_file(at_fd) == NGX_FILE_ERROR) {
|
||||||
ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
|
ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
|
||||||
ngx_close_file_n " \"%V\" failed", &at_name);
|
ngx_close_file_n " \"%V\" failed", &at_name);
|
||||||
}
|
}
|
||||||
@ -642,7 +642,7 @@ ngx_open_file_wrapper(ngx_str_t *name, ngx_open_file_info_t *of,
|
|||||||
at_name.len = cp - at_name.data;
|
at_name.len = cp - at_name.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p == end && at_fd != AT_FDCWD) {
|
if (p == end && at_fd != NGX_AT_FDCWD) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If pathname ends with a trailing slash, check if last path
|
* If pathname ends with a trailing slash, check if last path
|
||||||
@ -690,7 +690,7 @@ ngx_open_file_wrapper(ngx_str_t *name, ngx_open_file_info_t *of,
|
|||||||
|
|
||||||
failed:
|
failed:
|
||||||
|
|
||||||
if (at_fd != AT_FDCWD && ngx_close_file(at_fd) == NGX_FILE_ERROR) {
|
if (at_fd != NGX_AT_FDCWD && ngx_close_file(at_fd) == NGX_FILE_ERROR) {
|
||||||
ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
|
ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
|
||||||
ngx_close_file_n " \"%V\" failed", &at_name);
|
ngx_close_file_n " \"%V\" failed", &at_name);
|
||||||
}
|
}
|
||||||
|
@ -340,6 +340,8 @@ size_t ngx_fs_bsize(u_char *name);
|
|||||||
|
|
||||||
#define ngx_file_at_info_n "fstatat()"
|
#define ngx_file_at_info_n "fstatat()"
|
||||||
|
|
||||||
|
#define NGX_AT_FDCWD (ngx_fd_t) AT_FDCWD
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user