Mercurial > hg > nginx
comparison src/core/ngx_open_file_cache.c @ 4485:f7d131008e9c
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.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 20 Feb 2012 19:14:35 +0000 |
parents | f78a29a2f9e6 |
children | a996bb40a0bb |
comparison
equal
deleted
inserted
replaced
4484:f78a29a2f9e6 | 4485:f7d131008e9c |
---|---|
580 } | 580 } |
581 | 581 |
582 p = name->data; | 582 p = name->data; |
583 end = p + name->len; | 583 end = p + name->len; |
584 | 584 |
585 at_fd = AT_FDCWD; | 585 at_fd = NGX_AT_FDCWD; |
586 at_name = *name; | 586 at_name = *name; |
587 | 587 |
588 if (p[0] == '/') { | 588 if (p[0] == '/') { |
589 at_fd = ngx_openat_file(at_fd, "/", | 589 at_fd = ngx_openat_file(at_fd, "/", |
590 NGX_FILE_RDONLY|NGX_FILE_NONBLOCK, | 590 NGX_FILE_RDONLY|NGX_FILE_NONBLOCK, |
630 of->err = ngx_errno; | 630 of->err = ngx_errno; |
631 of->failed = ngx_openat_file_n; | 631 of->failed = ngx_openat_file_n; |
632 goto failed; | 632 goto failed; |
633 } | 633 } |
634 | 634 |
635 if (at_fd != AT_FDCWD && ngx_close_file(at_fd) == NGX_FILE_ERROR) { | 635 if (at_fd != NGX_AT_FDCWD && ngx_close_file(at_fd) == NGX_FILE_ERROR) { |
636 ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, | 636 ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, |
637 ngx_close_file_n " \"%V\" failed", &at_name); | 637 ngx_close_file_n " \"%V\" failed", &at_name); |
638 } | 638 } |
639 | 639 |
640 p = cp + 1; | 640 p = cp + 1; |
641 at_fd = fd; | 641 at_fd = fd; |
642 at_name.len = cp - at_name.data; | 642 at_name.len = cp - at_name.data; |
643 } | 643 } |
644 | 644 |
645 if (p == end && at_fd != AT_FDCWD) { | 645 if (p == end && at_fd != NGX_AT_FDCWD) { |
646 | 646 |
647 /* | 647 /* |
648 * If pathname ends with a trailing slash, check if last path | 648 * If pathname ends with a trailing slash, check if last path |
649 * component is a directory; if not, fail with ENOTDIR as per | 649 * component is a directory; if not, fail with ENOTDIR as per |
650 * POSIX. | 650 * POSIX. |
688 of->failed = ngx_openat_file_n; | 688 of->failed = ngx_openat_file_n; |
689 } | 689 } |
690 | 690 |
691 failed: | 691 failed: |
692 | 692 |
693 if (at_fd != AT_FDCWD && ngx_close_file(at_fd) == NGX_FILE_ERROR) { | 693 if (at_fd != NGX_AT_FDCWD && ngx_close_file(at_fd) == NGX_FILE_ERROR) { |
694 ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, | 694 ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, |
695 ngx_close_file_n " \"%V\" failed", &at_name); | 695 ngx_close_file_n " \"%V\" failed", &at_name); |
696 } | 696 } |
697 | 697 |
698 return fd; | 698 return fd; |