diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2008-11-20 17:23:08 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2008-11-20 17:23:08 +0000 |
| commit | d0d575bcd5201eab1aacdf682f6fc11d1f46c682 (patch) | |
| tree | 46a8602d403f496399972b2958990e041b4a4972 /src/core/nginx.c | |
| parent | 3d87cb964c1388b41552c08358987df320943386 (diff) | |
| download | nginx-d0d575bcd5201eab1aacdf682f6fc11d1f46c682.tar.gz nginx-d0d575bcd5201eab1aacdf682f6fc11d1f46c682.tar.bz2 | |
r2303 merge:
compatibility with glibc 2.3, warn_unused_result attribute for write()
Diffstat (limited to 'src/core/nginx.c')
| -rw-r--r-- | src/core/nginx.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/core/nginx.c b/src/core/nginx.c index 48e085ba3..28624db76 100644 --- a/src/core/nginx.c +++ b/src/core/nginx.c @@ -192,6 +192,8 @@ static char **ngx_os_environ; int ngx_cdecl main(int argc, char *const *argv) { + char *p; + ssize_t n; ngx_int_t i; ngx_log_t *log; ngx_cycle_t *cycle, init_cycle; @@ -241,23 +243,30 @@ 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); + + p = "nginx version: " NGINX_VER CRLF; + n = sizeof("nginx version: " NGINX_VER CRLF) - 1; + + if (ngx_write_fd(ngx_stderr_fileno, p, n) != n) { + 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); -#endif + p = "built by " NGX_COMPILER CRLF; + n = sizeof("built by " NGX_COMPILER CRLF) - 1; -#ifndef __WATCOMC__ + if (ngx_write_fd(ngx_stderr_fileno, p, n) != n) { + return 1; + } +#endif - /* OpenWatcomC could not build the long NGX_CONFIGURE string */ + p = "configure arguments: " NGX_CONFIGURE CRLF; + n = sizeof("configure arguments :" NGX_CONFIGURE CRLF) - 1; - ngx_write_fd(ngx_stderr_fileno, - "configure arguments: " NGX_CONFIGURE CRLF, - sizeof("configure arguments :" NGX_CONFIGURE CRLF) - 1); -#endif + if (ngx_write_fd(ngx_stderr_fileno, p, n) != n) { + return 1; + } } if (!ngx_test_config) { |
