

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
11 messages in ru.sysoev.nginxRe: Compilation errors on Ubuntu 8.10...| From | Sent On | Attachments |
|---|---|---|
| Eric Benson | Nov 10, 2008 9:38 am | .log, .diff |
| Igor Sysoev | Nov 10, 2008 12:34 pm | .Other |
| Eric Benson | Nov 10, 2008 1:25 pm | |
| Maxim Dounin | Nov 10, 2008 1:35 pm | |
| Igor Sysoev | Nov 10, 2008 1:43 pm | |
| Eric Benson | Nov 10, 2008 2:27 pm | |
| Maxim Dounin | Nov 10, 2008 3:47 pm | |
| Maxim Dounin | Nov 10, 2008 4:29 pm | .txt |
| Igor Sysoev | Nov 10, 2008 10:35 pm | .Other |
| Eric Benson | Nov 10, 2008 11:24 pm | |
| mike | Nov 10, 2008 11:33 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: Compilation errors on Ubuntu 8.10 Intrepid Ibex | Actions... |
|---|---|---|
| From: | Maxim Dounin (mdou...@mdounin.ru) | |
| Date: | Nov 10, 2008 4:29:52 pm | |
| List: | ru.sysoev.nginx | |
| Attachments: | ||
Hello!
[... warn_unused_result discussion skipped ...]
What about attached patch instead? Actually, there is only 1 place where we really can't do anything - write() while logging error. In other places sensible behaviour is possible.
Maxim Dounin
diff --git a/src/core/nginx.c b/src/core/nginx.c --- a/src/core/nginx.c +++ b/src/core/nginx.c @@ -240,22 +240,34 @@ main(int argc, char *const *argv) }
if (ngx_show_version) { - ngx_write_fd(ngx_stderr_fileno, "nginx version: " NGINX_VER CRLF, - sizeof("nginx version: " NGINX_VER CRLF) - 1); + if (ngx_write_fd(ngx_stderr_fileno, "nginx version: " NGINX_VER CRLF, + sizeof("nginx version: " NGINX_VER CRLF) - 1) + != sizeof("nginx version: " NGINX_VER CRLF) - 1) + { + return 1; + }
if (ngx_show_configure) { #ifdef NGX_COMPILER - ngx_write_fd(ngx_stderr_fileno, "built by " NGX_COMPILER CRLF, - sizeof("built by " NGX_COMPILER CRLF) - 1); + if (ngx_write_fd(ngx_stderr_fileno, "built by " NGX_COMPILER CRLF, + sizeof("built by " NGX_COMPILER CRLF) - 1) + != sizeof("built by " NGX_COMPILER CRLF) - 1) + { + return 1; + } #endif
#ifndef __WATCOMC__
/* OpenWatcomC could not build the long NGX_CONFIGURE string */
- ngx_write_fd(ngx_stderr_fileno,
+ if (ngx_write_fd(ngx_stderr_fileno,
"configure arguments: " NGX_CONFIGURE CRLF,
- sizeof("configure arguments :" NGX_CONFIGURE CRLF) -
1);
+ sizeof("configure arguments :" NGX_CONFIGURE CRLF) - 1)
+ != sizeof("configure arguments :" NGX_CONFIGURE CRLF) - 1)
+ {
+ return 1;
+ }
#endif
}
diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c --- a/src/core/ngx_conf_file.c +++ b/src/core/ngx_conf_file.c @@ -912,6 +912,7 @@ static void static void ngx_conf_flush_files(ngx_cycle_t *cycle) { + ngx_int_t n; ngx_uint_t i; ngx_list_part_t *part; ngx_open_file_t *file; @@ -936,7 +937,17 @@ ngx_conf_flush_files(ngx_cycle_t *cycle) continue; }
- ngx_write_fd(file[i].fd, file[i].buffer, file[i].pos - file[i].buffer);
+ n = ngx_write_fd(file[i].fd, file[i].buffer, file[i].pos -
file[i].buffer);
+
+ if (n == NGX_FILE_ERROR) {
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
+ ngx_write_fd_n " to \"%s\" failed",
file[i].name.data);
+
+ } else if (n != file[i].pos - file[i].buffer) {
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
+ ngx_write_fd_n " to \"%s\" was incomplete: %z of
%uz",
+ file[i].name.data, n, file[i].pos - file[i].buffer);
+ }
}
}
diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c --- a/src/core/ngx_cycle.c +++ b/src/core/ngx_cycle.c @@ -997,6 +997,7 @@ ngx_reopen_files(ngx_cycle_t *cycle, ngx ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user) { ngx_fd_t fd; + ngx_int_t n; ngx_uint_t i; ngx_list_part_t *part; ngx_open_file_t *file; @@ -1020,8 +1021,19 @@ ngx_reopen_files(ngx_cycle_t *cycle, ngx }
if (file[i].buffer && file[i].pos - file[i].buffer != 0) {
- ngx_write_fd(file[i].fd, file[i].buffer,
- file[i].pos - file[i].buffer);
+ n = ngx_write_fd(file[i].fd, file[i].buffer,
+ file[i].pos - file[i].buffer);
+
+ if (n == NGX_FILE_ERROR) {
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
+ ngx_write_fd_n " to \"%s\" failed",
file[i].name.data);
+
+ } else if (n != file[i].pos - file[i].buffer) {
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
+ ngx_write_fd_n " to \"%s\" was incomplete: %z of
%uz",
+ file[i].name.data, n, file[i].pos -
file[i].buffer);
+ }
+
file[i].pos = file[i].buffer;
}
diff --git a/src/core/ngx_log.c b/src/core/ngx_log.c --- a/src/core/ngx_log.c +++ b/src/core/ngx_log.c @@ -158,7 +158,9 @@ ngx_log_error_core(ngx_uint_t level, ngx
ngx_linefeed(p);
- ngx_write_fd(log->file->fd, errstr, p - errstr); + if (ngx_write_fd(log->file->fd, errstr, p - errstr) == NGX_FILE_ERROR) { + /* error logging error - ignore */ + } }








.log, .diff