[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apr-cvs
Subject:    svn commit: r1891310 - /apr/apr/trunk/test/proc_child.c
From:       jorton () apache ! org
Date:       2021-07-06 12:22:40
Message-ID: 20210706122240.CB09E17A82C () svn01-us-east ! apache ! org
[Download RAW message or body]

Author: jorton
Date: Tue Jul  6 12:22:40 2021
New Revision: 1891310

URL: http://svn.apache.org/viewvc?rev=1891310&view=rev
Log:
* test/proc_child.c (main): Avoid gcc -Wunused-result warning with
  write() return value.

Modified:
    apr/apr/trunk/test/proc_child.c

Modified: apr/apr/trunk/test/proc_child.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/proc_child.c?rev=1891310&r1=1891309&r2=1891310&view=diff
 ==============================================================================
--- apr/apr/trunk/test/proc_child.c (original)
+++ apr/apr/trunk/test/proc_child.c Tue Jul  6 12:22:40 2021
@@ -11,11 +11,11 @@
 int main(void)
 {
     char buf[256];
-    int bytes;
+    int bytes, rv = 0;
     
     bytes = (int)read(STDIN_FILENO, buf, 256);
     if (bytes > 0)
-        write(STDOUT_FILENO, buf, (unsigned int)bytes);
+        rv = write(STDOUT_FILENO, buf, (unsigned int)bytes) == bytes ? 0 : 1;
 
-    return 0; /* just to keep the compiler happy */
+    return rv;
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic