Compilation errors on Ubuntu 8.10 Intrepid Ibex

Igor Sysoev is at rambler-co.ru
Mon Nov 10 23:34:37 MSK 2008


On Mon, Nov 10, 2008 at 09:38:39AM -0800, Eric Benson wrote:

> Compiling either 0.6.32 or 0.7.20 on a new Ubuntu 8.10 installation with gcc 4.3.2 causes errors due to a new compiler warning (when combined with the use of -Werror in CFLAGS). There is now a compiler warning when the return value of write() is ignored. This causes errors in a number of placees in nginx. I have included a log showing the compiler output as well as a patch file showing the changes I made to avoid these errors.

Thank you.
However, there is more elegant way to suppress this warning without
stub variables:

      (void) write_fd(...)

Could you test the attached patch ?


-- 
Igor Sysoev
http://sysoev.ru/en/
-------------- next part --------------
Index: src/core/ngx_conf_file.c
===================================================================
--- src/core/ngx_conf_file.c	(revision 1618)
+++ src/core/ngx_conf_file.c	(working copy)
@@ -936,7 +936,8 @@
             continue;
         }
 
-        ngx_write_fd(file[i].fd, file[i].buffer, file[i].pos - file[i].buffer);
+        (void) ngx_write_fd(file[i].fd, file[i].buffer,
+                            file[i].pos - file[i].buffer);
     }
 }
 
Index: src/core/nginx.c
===================================================================
--- src/core/nginx.c	(revision 1618)
+++ src/core/nginx.c	(working copy)
@@ -240,22 +240,24 @@
     }
 
     if (ngx_show_version) {
-        ngx_write_fd(ngx_stderr_fileno, "nginx version: " NGINX_VER CRLF,
-                     sizeof("nginx version: " NGINX_VER CRLF) - 1);
+        (void) ngx_write_fd(ngx_stderr_fileno,
+                            "nginx version: " NGINX_VER CRLF,
+                            sizeof("nginx version: " NGINX_VER CRLF) - 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);
+            (void) ngx_write_fd(ngx_stderr_fileno,
+                                "built by " NGX_COMPILER CRLF,
+                                sizeof("built by " NGX_COMPILER CRLF) - 1);
 #endif
 
 #ifndef __WATCOMC__
 
             /* OpenWatcomC could not build the long NGX_CONFIGURE string */
 
-            ngx_write_fd(ngx_stderr_fileno,
-                        "configure arguments: " NGX_CONFIGURE CRLF,
-                        sizeof("configure arguments :" NGX_CONFIGURE CRLF) - 1);
+            (void) ngx_write_fd(ngx_stderr_fileno,
+                       "configure arguments: " NGX_CONFIGURE CRLF,
+                       sizeof("configure arguments :" NGX_CONFIGURE CRLF) - 1);
 #endif
         }
 
Index: src/core/ngx_log.c
===================================================================
--- src/core/ngx_log.c	(revision 1618)
+++ src/core/ngx_log.c	(working copy)
@@ -158,7 +158,7 @@
 
     ngx_linefeed(p);
 
-    ngx_write_fd(log->file->fd, errstr, p - errstr);
+    (void) ngx_write_fd(log->file->fd, errstr, p - errstr);
 }
 
 
Index: src/core/ngx_cycle.c
===================================================================
--- src/core/ngx_cycle.c	(revision 1618)
+++ src/core/ngx_cycle.c	(working copy)
@@ -1020,8 +1020,8 @@
         }
 
         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);
+            (void) ngx_write_fd(file[i].fd, file[i].buffer,
+                                file[i].pos - file[i].buffer);
             file[i].pos = file[i].buffer;
         }
 


More information about the nginx mailing list