]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
ncb: Check return value of write()
authorPeter Tyser <ptyser@xes-inc.com>
Fri, 24 Apr 2009 20:59:46 +0000 (15:59 -0500)
committerWolfgang Denk <wd@denx.de>
Mon, 27 Apr 2009 23:16:46 +0000 (01:16 +0200)
This prevents the compilation warning:

ncb.c: In function 'main':
ncb.c:32: warning: ignoring return value of ‘write’, declared with
attribute warn_unused_result

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
tools/ncb.c

index 30acbead5f3bfb7ec0e27719a388608b0a92e33c..ec8d8a7435208e432b81b8daf29be868ec408921 100644 (file)
@@ -1,3 +1,4 @@
+#include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <sys/socket.h>
@@ -29,7 +30,8 @@ int main (int argc, char *argv[])
                len = recvfrom (s, buf, sizeof buf, 0, (struct sockaddr *) &addr, &addr_len);
                if (len < 0)
                        break;
-               write (1, buf, len);
+               if (write (1, buf, len) != len)
+                       fprintf(stderr, "WARNING: serial characters dropped\n");
        }
 
        return 0;